public async Task <ActionResult> UpdateResourceSet([FromBody] PutResourceSet putResourceSet)
        {
            if (putResourceSet == null)
            {
                return(BuildError(ErrorCodes.InvalidRequestCode, "no parameter in body request", HttpStatusCode.BadRequest));
            }

            var parameter         = putResourceSet.ToParameter();
            var resourceSetExists = await _resourceSetActions.UpdateResourceSet(parameter);

            if (!resourceSetExists)
            {
                return(GetNotFoundResourceSet());
            }

            var response = new UpdateResourceSetResponse
            {
                Id = putResourceSet.Id
            };

            await _representationManager.AddOrUpdateRepresentationAsync(this, Constants.CachingStoreNames.GetResourceStoreName + putResourceSet.Id, false);

            return(new ObjectResult(response)
            {
                StatusCode = (int)HttpStatusCode.OK
            });
        }
Exemplo n.º 2
0
        public async Task <ActionResult> UpdateResourceSet([FromBody] PutResourceSet putResourceSet)
        {
            if (putResourceSet == null)
            {
                throw new ArgumentNullException(nameof(putResourceSet));
            }

            var parameter         = putResourceSet.ToParameter();
            var resourceSetExists = await _resourceSetActions.UpdateResourceSet(parameter);

            if (!resourceSetExists)
            {
                return(GetNotFoundResourceSet());
            }

            var response = new UpdateResourceSetResponse
            {
                Id = putResourceSet.Id
            };

            await _representationManager.AddOrUpdateRepresentationAsync(this, CachingStoreNames.GetResourceStoreName + putResourceSet.Id, false);

            return(new ObjectResult(response)
            {
                StatusCode = (int)HttpStatusCode.OK
            });
        }
Exemplo n.º 3
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateResourceSetResponse response = new UpdateResourceSetResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("resources", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Resource, ResourceUnmarshaller>(ResourceUnmarshaller.Instance);
                    response.Resources = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("resourceSetArn", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ResourceSetArn = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("resourceSetName", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ResourceSetName = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("resourceSetType", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ResourceSetType = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("tags", targetDepth))
                {
                    var unmarshaller = new DictionaryUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
                    response.Tags = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }