Exemplo n.º 1
0
        /// <summary>
        /// List container images in a compartment.
        /// </summary>
        /// <param name="request">The request object containing the details to send. Required.</param>
        /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
        /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
        /// <returns>A response object containing details about the completed operation</returns>
        /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/artifacts/ListContainerImages.cs.html">here</a> to see an example of how to use ListContainerImages API.</example>
        public async Task <ListContainerImagesResponse> ListContainerImages(ListContainerImagesRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called listContainerImages");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/container/images".Trim('/')));
            HttpMethod         method         = new HttpMethod("GET");
            HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);

            requestMessage.Headers.Add("Accept", "application/json");
            GenericRetrier      retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
            HttpResponseMessage responseMessage;

            try
            {
                if (retryingClient != null)
                {
                    responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
                }
                this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);

                return(Converter.FromHttpResponseMessage <ListContainerImagesResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"ListContainerImages failed with error: {e.Message}");
                throw;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Lists custom container images for a title.
        /// </summary>
        public static void ListContainerImages(ListContainerImagesRequest request, Action <ListContainerImagesResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;


            PlayFabHttp.MakeApiCall("/MultiplayerServer/ListContainerImages", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context);
        }
        /// <summary>
        /// Lists custom container images for a title.
        /// </summary>
        public void ListContainerImages(ListContainerImagesRequest request, Action <ListContainerImagesResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            var context      = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
            var callSettings = apiSettings ?? PlayFabSettings.staticSettings;

            if (!context.IsEntityLoggedIn())
            {
                throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn, "Must be logged in to call this method");
            }
            PlayFabHttp.MakeApiCall("/MultiplayerServer/ListContainerImages", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListContainerImagesRequest request;

            try
            {
                request = new ListContainerImagesRequest
                {
                    CompartmentId          = CompartmentId,
                    CompartmentIdInSubtree = CompartmentIdInSubtree,
                    DisplayName            = DisplayName,
                    ImageId        = ImageId,
                    IsVersioned    = IsVersioned,
                    RepositoryId   = RepositoryId,
                    RepositoryName = RepositoryName,
                    Version        = Version,
                    LifecycleState = LifecycleState,
                    Limit          = Limit,
                    Page           = Page,
                    OpcRequestId   = OpcRequestId,
                    SortBy         = SortBy,
                    SortOrder      = SortOrder
                };
                IEnumerable <ListContainerImagesResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.ContainerImageCollection, true);
                }
                if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null)
                {
                    WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources.");
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Lists custom container images for a title.
 /// </summary>
 public static void ListContainerImages(ListContainerImagesRequest request, Action <ListContainerImagesResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
 {
     PlayFabHttp.MakeApiCall("/MultiplayerServer/ListContainerImages", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a new enumerable which will iterate over the ContainerImageSummary objects
 /// contained in responses from the ListContainerImages operation. This enumerable will fetch more data from the server as needed.
 /// </summary>
 /// <param name="request">The request object containing the details to send</param>
 /// <param name="retryConfiguration">The configuration for retrying, may be null</param>
 /// <param name="cancellationToken">The cancellation token object</param>
 /// <returns>The enumerator, which supports a simple iteration over a collection of a specified type</returns>
 public IEnumerable <ContainerImageSummary> ListContainerImagesRecordEnumerator(ListContainerImagesRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
 {
     return(new Common.Utils.ResponseRecordEnumerable <ListContainerImagesRequest, ListContainerImagesResponse, ContainerImageSummary>(
                response => response.OpcNextPage,
                input =>
     {
         if (!string.IsNullOrEmpty(input))
         {
             request.Page = input;
         }
         return request;
     },
                request => client.ListContainerImages(request, retryConfiguration, cancellationToken),
                response => response.ContainerImageCollection.Items
                ));
 }
Exemplo n.º 7
0
        /// <summary>
        /// Lists custom container images for a title.
        /// </summary>
        public static async Task <PlayFabResult <ListContainerImagesResponse> > ListContainerImagesAsync(ListContainerImagesRequest request, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            if (PlayFabSettings.EntityToken == null)
            {
                throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call GetEntityToken before calling this method");
            }

            var httpResult = await PlayFabHttp.DoPost("/MultiplayerServer/ListContainerImages", request, "X-EntityToken", PlayFabSettings.EntityToken, extraHeaders);

            if (httpResult is PlayFabError)
            {
                var error = (PlayFabError)httpResult;
                PlayFabSettings.GlobalErrorHandler?.Invoke(error);
                return(new PlayFabResult <ListContainerImagesResponse> {
                    Error = error, CustomData = customData
                });
            }

            var resultRawJson = (string)httpResult;
            var resultData    = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <ListContainerImagesResponse> >(resultRawJson);
            var result        = resultData.data;

            return(new PlayFabResult <ListContainerImagesResponse> {
                Result = result, CustomData = customData
            });
        }