/// <summary>
 /// Initializes a new instance of the <see cref="CreateNotificationsService"/> class.
 /// </summary>
 /// <param name="marainServicesTenancy">Marain tenancy services.</param>
 /// <param name="operationsControlClient">The operations control client.</param>
 public CreateNotificationsService(
     IMarainServicesTenancy marainServicesTenancy,
     IMarainOperationsControl operationsControlClient)
 {
     this.marainServicesTenancy   = marainServicesTenancy;
     this.operationsControlClient = operationsControlClient;
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CompleteLongRunningOperationActivity"/> class.
 /// </summary>
 /// <param name="marainServicesTenancy">Marain tenancy services.</param>
 /// <param name="operationsControl">The operations control client.</param>
 public CompleteLongRunningOperationActivity(
     IMarainServicesTenancy marainServicesTenancy,
     IMarainOperationsControl operationsControl)
 {
     this.operationsControl     = operationsControl;
     this.marainServicesTenancy = marainServicesTenancy;
 }
Beispiel #3
0
 /// <summary>
 /// Create a new operation, which will be in the "Not Started" state
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tenantId'>
 /// Id of the Tenant.
 /// </param>
 /// <param name='operationId'>
 /// Id of the Operation.
 /// </param>
 /// <param name='resourceLocation'>
 /// Optional URI based location of the result of the Operation.
 /// </param>
 /// <param name='expireAfter'>
 /// Optional number of seconds for which to retain data about this operation
 /// after its last state change
 /// </param>
 /// <param name='body'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <CreateOperationHeaders> CreateOperationAsync(this IMarainOperationsControl operations, string tenantId, System.Guid operationId, string resourceLocation = default(string), long?expireAfter = default(long?), string body = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOperationWithHttpMessagesAsync(tenantId, operationId, resourceLocation, expireAfter, body, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Headers);
     }
 }
Beispiel #4
0
 /// <summary>
 /// View swagger definition for this API
 /// </summary>
 /// <remarks>
 /// View swagger definition for this API
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> GetSwaggerAsync(this IMarainOperationsControl operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetSwaggerWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Set an operation into the "Succeeded" state
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tenantId'>
 /// Id of the Tenant.
 /// </param>
 /// <param name='operationId'>
 /// Id of Operation.
 /// </param>
 /// <param name='resourceLocation'>
 /// Optional URI based location of the result of the Operation.
 /// </param>
 /// <param name='expireAfter'>
 /// Optional number of seconds for which to retain data about this operation
 /// after its last state change
 /// </param>
 /// <param name='body'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ProblemDetails> SetOperationSucceededAsync(this IMarainOperationsControl operations, string tenantId, System.Guid operationId, string resourceLocation = default(string), long?expireAfter = default(long?), string body = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.SetOperationSucceededWithHttpMessagesAsync(tenantId, operationId, resourceLocation, expireAfter, body, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateNotificationsService"/> class.
 /// </summary>
 /// <param name="marainServicesTenancy">Marain tenancy services.</param>
 /// <param name="operationsControlClient">The operations control client.</param>
 public BatchReadStatusUpdateService(
     IMarainServicesTenancy marainServicesTenancy,
     IMarainOperationsControl operationsControlClient)
 {
     this.marainServicesTenancy   = marainServicesTenancy;
     this.operationsControlClient = operationsControlClient;
 }
Beispiel #7
0
 /// <summary>
 /// Set an operation into the "Running" state
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tenantId'>
 /// Id of the Tenant.
 /// </param>
 /// <param name='operationId'>
 /// Id of the Operation.
 /// </param>
 /// <param name='percentComplete'>
 /// Optional percentage completeness of the Operation.
 /// </param>
 /// <param name='contentId'>
 /// Optional Content Id of Localized Content status message.
 /// </param>
 /// <param name='expireAfter'>
 /// Optional number of seconds for which to retain data about this operation
 /// after its last state change
 /// </param>
 /// <param name='body'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ProblemDetails> SetOperationRunningAsync(this IMarainOperationsControl operations, string tenantId, System.Guid operationId, int?percentComplete = default(int?), string contentId = default(string), long?expireAfter = default(long?), string body = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.SetOperationRunningWithHttpMessagesAsync(tenantId, operationId, percentComplete, contentId, expireAfter, body, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        public async Task WhenIUseTheOperationsControlClientToCreateAnOperation(Table table)
        {
            string idName           = table.Rows[0]["IdName"];
            Guid   id               = this.ScenarioContext.Get <Guid>(idName);
            string resourceLocation = table.Rows[0]["ResourceLocation"];
            long   expireAfter      = long.Parse(table.Rows[0]["ExpireAfter"]);
            string body             = table.Rows[0]["Body"];

            IServiceProvider         serviceProvider = ContainerBindings.GetServiceProvider(this.FeatureContext);
            IMarainOperationsControl client          = serviceProvider.GetRequiredService <IMarainOperationsControl>();
            var transientTenantManager = TransientTenantManager.GetInstance(this.FeatureContext);

            await Exceptions.ExecuteAndStoreExceptionAsync(
                this.ScenarioContext,
                async() =>
            {
                CreateOperationHeaders result = await client.CreateOperationAsync(
                    transientTenantManager.PrimaryTransientClient.Id,
                    id,
                    resourceLocation,
                    expireAfter,
                    body).ConfigureAwait(false);

                this.ScenarioContext.Set(result);
            }).ConfigureAwait(false);
        }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageIngestionService" /> class.
 /// </summary>
 /// <param name="serializerSettingsProvider">Serialization settings provider.</param>
 /// <param name="propertyBagFactory">Factory to use when creating initial IPropertyBag instances for workflow message envelopes.</param>
 /// <param name="operationsControl">Allows definition and control of long-running operations.</param>
 /// <param name="marainServicesTenancy">Marain tenancy services.</param>
 public MessageIngestionService(
     IJsonSerializerSettingsProvider serializerSettingsProvider,
     IPropertyBagFactory propertyBagFactory,
     IMarainOperationsControl operationsControl,
     IMarainServicesTenancy marainServicesTenancy)
 {
     this.marainServicesTenancy      = marainServicesTenancy;
     this.operationsControl          = operationsControl;
     this.serializerSettingsProvider = serializerSettingsProvider;
     this.propertyBagFactory         = propertyBagFactory;
 }
        public async Task WhenIUseTheOperationsControlClientToCreateAnOperationWithTheIdCalled(string operationIdName)
        {
            Guid operationId = this.ScenarioContext.Get <Guid>(operationIdName);

            IServiceProvider         serviceProvider = ContainerBindings.GetServiceProvider(this.FeatureContext);
            IMarainOperationsControl client          = serviceProvider.GetRequiredService <IMarainOperationsControl>();
            var transientTenantManager = TransientTenantManager.GetInstance(this.FeatureContext);

            await Exceptions.ExecuteAndStoreExceptionAsync(
                this.ScenarioContext,
                async() =>
            {
                CreateOperationHeaders result = await client.CreateOperationAsync(
                    transientTenantManager.PrimaryTransientClient.Id,
                    operationId).ConfigureAwait(false);

                this.ScenarioContext.Set(result);
            }).ConfigureAwait(false);
        }
        public async Task GivenIUseTheOperationsControlClientToSetTheStatusOfTheOperationWithIdCalledToFailed(string operationIdName)
        {
            Guid id = this.ScenarioContext.Get <Guid>(operationIdName);

            IServiceProvider         serviceProvider = ContainerBindings.GetServiceProvider(this.FeatureContext);
            IMarainOperationsControl client          = serviceProvider.GetRequiredService <IMarainOperationsControl>();
            var transientTenantManager = TransientTenantManager.GetInstance(this.FeatureContext);

            await Exceptions.ExecuteAndStoreExceptionAsync(
                this.ScenarioContext,
                async() =>
            {
                ProblemDetails?result = await client.SetOperationFailedAsync(
                    transientTenantManager.PrimaryTransientClient.Id,
                    id).ConfigureAwait(false);

                this.ScenarioContext.Set(result);
            }).ConfigureAwait(false);
        }
Beispiel #12
0
 /// <summary>
 /// Set an existing operation into the "Failed" state
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tenantId'>
 /// Id of the Tenant.
 /// </param>
 /// <param name='operationId'>
 /// Id of the Operation.
 /// </param>
 /// <param name='expireAfter'>
 /// Optional number of seconds for which to retain data about this operation
 /// after its last state change
 /// </param>
 /// <param name='body'>
 /// </param>
 public static ProblemDetails SetOperationFailed(this IMarainOperationsControl operations, string tenantId, System.Guid operationId, long?expireAfter = default(long?), string body = default(string))
 {
     return(operations.SetOperationFailedAsync(tenantId, operationId, expireAfter, body).GetAwaiter().GetResult());
 }
Beispiel #13
0
 /// <summary>
 /// Create a new operation, which will be in the "Not Started" state
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tenantId'>
 /// Id of the Tenant.
 /// </param>
 /// <param name='operationId'>
 /// Id of the Operation.
 /// </param>
 /// <param name='resourceLocation'>
 /// Optional URI based location of the result of the Operation.
 /// </param>
 /// <param name='expireAfter'>
 /// Optional number of seconds for which to retain data about this operation
 /// after its last state change
 /// </param>
 /// <param name='body'>
 /// </param>
 public static CreateOperationHeaders CreateOperation(this IMarainOperationsControl operations, string tenantId, System.Guid operationId, string resourceLocation = default(string), long?expireAfter = default(long?), string body = default(string))
 {
     return(operations.CreateOperationAsync(tenantId, operationId, resourceLocation, expireAfter, body).GetAwaiter().GetResult());
 }
Beispiel #14
0
 /// <summary>
 /// View swagger definition for this API
 /// </summary>
 /// <remarks>
 /// View swagger definition for this API
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static object GetSwagger(this IMarainOperationsControl operations)
 {
     return(operations.GetSwaggerAsync().GetAwaiter().GetResult());
 }
Beispiel #15
0
 /// <summary>
 /// Set an operation into the "Running" state
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tenantId'>
 /// Id of the Tenant.
 /// </param>
 /// <param name='operationId'>
 /// Id of the Operation.
 /// </param>
 /// <param name='percentComplete'>
 /// Optional percentage completeness of the Operation.
 /// </param>
 /// <param name='contentId'>
 /// Optional Content Id of Localized Content status message.
 /// </param>
 /// <param name='expireAfter'>
 /// Optional number of seconds for which to retain data about this operation
 /// after its last state change
 /// </param>
 /// <param name='body'>
 /// </param>
 public static ProblemDetails SetOperationRunning(this IMarainOperationsControl operations, string tenantId, System.Guid operationId, int?percentComplete = default(int?), string contentId = default(string), long?expireAfter = default(long?), string body = default(string))
 {
     return(operations.SetOperationRunningAsync(tenantId, operationId, percentComplete, contentId, expireAfter, body).GetAwaiter().GetResult());
 }