Intro Here's the code that I learned to create for generating an authorization token: Writing the Test The following test was written to generate a bearer token: [<Test>] let ``get authorization token``() = let section = ConfigurationManager.GetSection("section.bearerToken") :?> NameValueCollection; let kvPairs = section.AllKeys.Select(fun k -> new KeyValuePair<string, string>(k, section[k])); let tenantId = kvPairs.Single(fun v -> …
Pulumi Code Examples
My hobby project consists of building a mobile delivery platform. Thus, I needed some Infrastructure as Code (aka: IaC) to provision deployments. My goal was to have code structured as follows: Fortunately, I was able to learn the basics and write the proof of concept in a short amount of time. Here's some clients to …
F#: Azure Service Bus (Topic Subscription)
Azure Topic Listener namespace Notifications.DataGateway open System open System.Text open System.Diagnostics open System.Threading.Tasks open Azure.Messaging.ServiceBus open Newtonsoft.Json open Notifications.DataTransfer open Notifications.DataGateway type AzureTopicListener<'T>(subscriptionInfo:SubscriptionInfo) as x = let topic = subscriptionInfo.Topic let subscription = subscriptionInfo.Subscription let connectionString = subscriptionInfo.ConnectionString let requested = Event<_>() let mutable serviceBusClient : ServiceBusClient = null let mutable processor : ServiceBusProcessor = …
Continue reading "F#: Azure Service Bus (Topic Subscription)"
F# Domain Modeling: IRS Tax Form 8889
I've discovered that IRS tax forms can serve as mind-numbing code katas. I attempted to domain model HSA Form 8889 in F#. The code can be found on my GitHub account. Language namespace HSATaxForm_2020 open System module rec Language = module InEligible = type Coverage = Medicare | TriCare | TriCareLife type Amount = float …
F# SQLProvider: In Action
Intro There's an F# library that provides an ORM experience that is arguably superior to Entity Framework. This library is the SqlProvider. Establishing Connection The following code establishes a connection to SQL Server: namespace DevOps.DataGateway open FSharp.Data.Sql module SqlConnection = //---------------------------------------------------------------------------------------------------- // UPDATE CONNECTION STRING !!! //---------------------------------------------------------------------------------------------------- [<Literal>] let string = "Data Source=MY_MACHINE_NAME\SqlExpress;Initial Catalog=DevOps;Integrated Security=True" …
Implementing F# inspired Result in C#
Here's a F# inspired Result type implemented in C#: public class Error { public Error(string error) => Value = error; public string Value { get; } } public class Result<T> { readonly string _error; public Result(Error error) => _error = error.Value; public Result(T value) => Value = value; public bool IsSuccessful { get => _error …
Azure Topic Listener on Mobile
Here's my brain dump before for a mobile app running an Azure Topic Listener: SubscriptionInfo Listener
Azure Topic Subscription using Filter
Here's how I once implemented an Azure Topic subscription:
Masterminds (Vol. 50)
Order fulfillment TDD applied prescriptively Thought leaders I agree with https://youtu.be/gh51wC-ARO0
Xamarin: Building a Real-time Listener for an Azure Topic
Recently, I had to implement an Azure Topic subscription within my Xamarin app. AzureTopicListener The code below is what I built to get my Xamarin app to subscribe to Azure topic that relies on a filter rule: Test Here's a test that I wrote: