/// <inheritdoc/> protected override void ProcessRecordInternal() { var applicationCapacityDescription = new ApplicationCapacityDescription( minimumNodes: this.MinimumNodes, maximumNodes: this.MaximumNodes, applicationMetrics: this.ApplicationMetrics); var managedApplicationIdentityDescription = new ManagedApplicationIdentityDescription( tokenServiceEndpoint: this.TokenServiceEndpoint, managedIdentities: this.ManagedIdentities); var applicationDescription = new ApplicationDescription( name: this.Name, typeName: this.TypeName, typeVersion: this.TypeVersion, parameters: this.Parameters?.ToDictionary <string, string>(), applicationCapacity: applicationCapacityDescription, managedApplicationIdentity: managedApplicationIdentityDescription); this.ServiceFabricClient.Applications.CreateApplicationAsync( applicationDescription: applicationDescription, serverTimeout: this.ServerTimeout, cancellationToken: this.CancellationToken).GetAwaiter().GetResult(); Console.WriteLine("Success!"); }
/// <summary> /// Serializes the object to JSON. /// </summary> /// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param> /// <param name="obj">The object to serialize to JSON.</param> internal static void Serialize(JsonWriter writer, ApplicationCapacityDescription obj) { // Required properties are always serialized, optional properties are serialized when not null. writer.WriteStartObject(); if (obj.MinimumNodes != null) { writer.WriteProperty(obj.MinimumNodes, "MinimumNodes", JsonWriterExtensions.WriteLongValue); } if (obj.MaximumNodes != null) { writer.WriteProperty(obj.MaximumNodes, "MaximumNodes", JsonWriterExtensions.WriteLongValue); } if (obj.ApplicationMetrics != null) { writer.WriteEnumerableProperty(obj.ApplicationMetrics, "ApplicationMetrics", ApplicationMetricDescriptionConverter.Serialize); } writer.WriteEndObject(); }