/// <summary>
        /// Creates a new instance of the ComputeServicePocoClient class.
        /// </summary>
        /// <param name="context">The compute service context to use for this client.</param>
        /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
        internal NetworkServicePocoClient(ServiceClientContext context, IServiceLocator serviceLocator)
        {
            serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create a network service poco client with a null service locator.");

            this._context = context;
            this.ServiceLocator = serviceLocator;
        }
 /// <summary>
 /// Creates an Http client to communicate with the remote OpenStack service.
 /// </summary>
 /// <param name="context">The compute context to use when creating the client.</param>
 /// <returns>The Http client.</returns>
 internal IHttpAbstractionClient GetHttpClient(ServiceClientContext context)
 {
     var client = this.ServiceLocator.Locate<IHttpAbstractionClientFactory>().Create(context.CancellationToken);
     AddAuthenticationHeader(context.Credential.AccessTokenId, client);
     client.Headers.Add("Accept", "application/json");
     return client;
 }
        /// <summary>
        /// Creates a new instance of the StorageServicePocoClient class.
        /// </summary>
        /// <param name="context">The storage service to use for this client.</param>
        /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
        internal StorageServicePocoClient(ServiceClientContext context, IServiceLocator serviceLocator)
        {
            serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create a storage service poco client with a null service locator.");

            this._context       = context;
            this.ServiceLocator = serviceLocator;
        }
        /// <summary>
        /// Creates a new instance of the OpenStackServiceRestClientBase class.
        /// </summary>
        /// <param name="context">The service client context for this object.</param>
        /// <param name="serviceLocator">A service locator for this object to use.</param>
        protected OpenStackServiceRestClientBase(ServiceClientContext context, IServiceLocator serviceLocator)
        {
            serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create a service rest client with a null service locator.");

            this.ServiceLocator = serviceLocator;
            this.Context        = context;
        }
        /// <summary>
        /// Creates a new instance of the OpenStackServiceRestClientBase class.
        /// </summary>
        /// <param name="context">The service client context for this object.</param>
        /// <param name="serviceLocator">A service locator for this object to use.</param>
        protected OpenStackServiceRestClientBase(ServiceClientContext context, IServiceLocator serviceLocator)
        {
            serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create a service rest client with a null service locator.");

            this.ServiceLocator = serviceLocator;
            this.Context = context;
        }
        /// <summary>
        /// Creates a new instance of the NetworkServiceClient class.
        /// </summary>
        /// <param name="credentials">The credential to be used by this client.</param>
        /// <param name="token">The cancellation token to be used by this client.</param>
        /// <param name="serviceName">The name of the service to be used by this client.</param>
        /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
        public NetworkServiceClient(IOpenStackCredential credentials, string serviceName, CancellationToken token, IServiceLocator serviceLocator)
        {
            serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create a network service client with a null service locator.");

            this.ServiceLocator = serviceLocator;
            var endpoint = new Uri(credentials.ServiceCatalog.GetPublicEndpoint(serviceName, credentials.Region));
            this.Context = new ServiceClientContext(credentials, token, serviceName, endpoint);
        }
        /// <summary>
        /// Creates an Http client to communicate with the remote OpenStack service.
        /// </summary>
        /// <param name="context">The compute context to use when creating the client.</param>
        /// <returns>The Http client.</returns>
        internal IHttpAbstractionClient GetHttpClient(ServiceClientContext context)
        {
            var client = this.ServiceLocator.Locate <IHttpAbstractionClientFactory>().Create(context.CancellationToken);

            AddAuthenticationHeader(context.Credential.AccessTokenId, client);
            client.Headers.Add("Accept", "application/json");
            return(client);
        }
Пример #8
0
        /// <summary>
        /// Creates a new instance of the ComputeServiceClient class.
        /// </summary>
        /// <param name="credentials">The credential to be used by this client.</param>
        /// <param name="token">The cancellation token to be used by this client.</param>
        /// <param name="serviceName">The name of the service to be used by this client.</param>
        /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
        public ComputeServiceClient(IOpenStackCredential credentials, string serviceName, CancellationToken token, IServiceLocator serviceLocator)
        {
            serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create a storage service client with a null service locator.");

            this.ServiceLocator = serviceLocator;
            var endpoint = new Uri(credentials.ServiceCatalog.GetPublicEndpoint(serviceName, credentials.Region));

            this.Context = new ServiceClientContext(credentials, token, serviceName, endpoint);
        }
        /// <summary>
        /// Creates a new instance of the StorageServiceClient class.
        /// </summary>
        /// <param name="credentials">The credential to be used by this client.</param>
        /// <param name="token">The cancellation token to be used by this client.</param>
        /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
        public StorageServiceClient(IOpenStackCredential credentials, string serviceName, CancellationToken token, IServiceLocator serviceLocator)
        {
            serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create a storage service client with a null service locator.");

            this.LargeObjectThreshold = 524288000; //Set the default large file threshold to 500MB.
            this.LargeObjectSegments = 10; //set the default number of segments for large objects to 10.
            this.LargeObjectSegmentContainer = "LargeObjectSegments"; //set the default name of the container that will hold segments to 'LargeObjectSegments';

            this.ServiceLocator = serviceLocator;
            var endpoint = new Uri(credentials.ServiceCatalog.GetPublicEndpoint(serviceName, credentials.Region));
            this.Context = new ServiceClientContext(credentials, token, serviceName, endpoint);
        }
        /// <summary>
        /// Creates a new instance of the StorageServiceClient class.
        /// </summary>
        /// <param name="credentials">The credential to be used by this client.</param>
        /// <param name="token">The cancellation token to be used by this client.</param>
        /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
        public StorageServiceClient(IOpenStackCredential credentials, string serviceName, CancellationToken token, IServiceLocator serviceLocator)
        {
            serviceLocator.AssertIsNotNull("serviceLocator", "Cannot create a storage service client with a null service locator.");

            this.LargeObjectThreshold        = 524288000;             //Set the default large file threshold to 500MB.
            this.LargeObjectSegments         = 10;                    //set the default number of segments for large objects to 10.
            this.LargeObjectSegmentContainer = "LargeObjectSegments"; //set the default name of the container that will hold segments to 'LargeObjectSegments';

            this.ServiceLocator = serviceLocator;
            var endpoint = new Uri(credentials.ServiceCatalog.GetPublicEndpoint(serviceName, credentials.Region));

            this.Context = new ServiceClientContext(credentials, token, serviceName, endpoint);
        }
Пример #11
0
        async Task NotifyClient <T>(T message, Task <ServiceClientContext> asyncContext)
        {
            ServiceClientContext clientContext = null;

            try
            {
                clientContext = await asyncContext.ConfigureAwait(false);

                var sendEndpointProvider = await _sendEndpointProvider.Task.ConfigureAwait(false);

                var endpoint = await sendEndpointProvider.GetSendEndpoint(clientContext.Address).ConfigureAwait(false);

                await endpoint.Send(message).ConfigureAwait(false);
            }
            catch (Exception exception)
            {
                if (clientContext != null)
                {
                    ClientCache.NotifyFaulted(clientContext, exception);
                }
            }
        }
 public INetworkServiceRestClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return(Client);
 }
 /// <inheritdoc/>
 public IComputeServiceRestClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return new ComputeServiceRestClient(context, serviceLocator);
 }
Пример #14
0
 /// <inheritdoc/>
 public INetworkServicePocoClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return(new NetworkServicePocoClient(context, serviceLocator));
 }
 public IComputeServicePocoClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return client;
 }
 /// <summary>
 /// Creates a new instance of the ComputeServiceRestClient class.
 /// </summary>
 /// <param name="context">The current service client context to use.</param>
 /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
 internal ComputeServiceRestClient(ServiceClientContext context, IServiceLocator serviceLocator)
     : base(context, serviceLocator)
 {
 }
 /// <inheritdoc/>
 public IStorageServiceRestClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return new StorageServiceRestClient(context, serviceLocator);
 }
 /// <summary>
 /// Creates a new instance of the NetworkServiceRestClient class.
 /// </summary>
 /// <param name="context">The current service context to use.</param>
 /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
 internal NetworkServiceRestClient(ServiceClientContext context, IServiceLocator serviceLocator) : base(context, serviceLocator)
 {
 }
 public void ValueRemoved(INode <ServiceClientContext> node, ServiceClientContext value)
 {
     _index.Remove(value.ClientId);
 }
 public void ValueAdded(INode <ServiceClientContext> node, ServiceClientContext value)
 {
 }
 public INetworkServicePocoClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return client;
 }
 /// <inheritdoc/>
 public IStorageServiceRestClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return(new StorageServiceRestClient(context, serviceLocator));
 }
Пример #23
0
 /// <inheritdoc/>
 public IComputeServiceRestClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return(new ComputeServiceRestClient(context, serviceLocator));
 }
Пример #24
0
 /// <summary>
 /// Creates a new instance of the ComputeServiceRestClient class.
 /// </summary>
 /// <param name="context">The current service client context to use.</param>
 /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
 internal ComputeServiceRestClient(ServiceClientContext context, IServiceLocator serviceLocator)
     : base(context, serviceLocator)
 {
 }
 /// <inheritdoc/>
 public INetworkServiceRestClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return new NetworkServiceRestClient(context, serviceLocator);
 }
 /// <summary>
 /// Creates a new instance of the StorageServiceRestClient class.
 /// </summary>
 /// <param name="context">The current storage service context to use.</param>
 /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
 internal StorageServiceRestClient(ServiceClientContext context, IServiceLocator serviceLocator)
     : base(context, serviceLocator)
 {
     this.StorageContainerNameValidator = this.ServiceLocator.Locate<IStorageContainerNameValidator>();
 }
Пример #27
0
 /// <summary>
 /// Creates a new instance of the StorageServiceRestClient class.
 /// </summary>
 /// <param name="context">The current storage service context to use.</param>
 /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
 internal StorageServiceRestClient(ServiceClientContext context, IServiceLocator serviceLocator)
     : base(context, serviceLocator)
 {
     this.StorageContainerNameValidator = this.ServiceLocator.Locate <IStorageContainerNameValidator>();
 }
Пример #28
0
 public IStorageServicePocoClient Create(ServiceClientContext context, IServiceLocator serviceLocator)
 {
     return(client);
 }
 /// <summary>
 /// Creates a new instance of the NetworkServiceRestClient class.
 /// </summary>
 /// <param name="context">The current service context to use.</param>
 /// <param name="serviceLocator">A service locator to be used to locate/inject dependent services.</param>
 internal NetworkServiceRestClient(ServiceClientContext context, IServiceLocator serviceLocator) : base(context, serviceLocator)
 {
 }