/// <summary>
 /// The RedirectAllRequestsTo value, This is the container for redirect information where all requests will be redirect
 /// to. You can redirect requests to another host, to another page, or with
 /// another protocol. In the event of an error, you can can specify a
 /// different error code to return. .
 /// </summary>
 /// <param name="redirectAllRequestsTo">The container for redirect information</param>
 /// <returns>the WebsiteConfiguration with the RedirectAllRequestsTo set</returns>
 public WebsiteConfiguration WithRedirectAllRequestsTo(RoutingRuleRedirect redirectAllRequestsTo)
 {
     this._redirectAllRequestsTo = redirectAllRequestsTo;
     return(this);
 }
 /// <summary>
 /// The RedirectAllRequestsTo value, This is the container for redirect information where all requests will be redirect
 /// to. You can redirect requests to another host, to another page, or with
 /// another protocol. In the event of an error, you can can specify a
 /// different error code to return. .
 /// </summary>
 /// <param name="redirectAllRequestsTo">The container for redirect information</param>
 /// <returns>the WebsiteConfiguration with the RedirectAllRequestsTo set</returns>
 public WebsiteConfiguration WithRedirectAllRequestsTo(RoutingRuleRedirect redirectAllRequestsTo)
 {
     this._redirectAllRequestsTo = redirectAllRequestsTo;
     return this;
 }
Пример #3
0
 /// <summary>
 /// You can redirect requests to another host, to 
 /// another page, or with another protocol. In the event of an error, you can can specify a different error code to return.
 /// </summary>
 /// <param name="redirect">The redirect settings for the routing rule.</param>
 /// <returns>the RoutingRuleCondition with the Redirect set</returns>
 public RoutingRule WithRedirect(RoutingRuleRedirect redirect)
 {
     this._redirect = redirect;
     return this;
 }
Пример #4
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.S3.Model.PutBucketWebsiteRequest();

            if (cmdletContext.BucketName != null)
            {
                request.BucketName = cmdletContext.BucketName;
            }

            // populate WebsiteConfiguration
            var requestWebsiteConfigurationIsNull = true;

            request.WebsiteConfiguration = new Amazon.S3.Model.WebsiteConfiguration();
            System.String requestWebsiteConfiguration_websiteConfiguration_ErrorDocument = null;
            if (cmdletContext.WebsiteConfiguration_ErrorDocument != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_ErrorDocument = cmdletContext.WebsiteConfiguration_ErrorDocument;
            }
            if (requestWebsiteConfiguration_websiteConfiguration_ErrorDocument != null)
            {
                request.WebsiteConfiguration.ErrorDocument = requestWebsiteConfiguration_websiteConfiguration_ErrorDocument;
                requestWebsiteConfigurationIsNull          = false;
            }
            System.String requestWebsiteConfiguration_websiteConfiguration_IndexDocumentSuffix = null;
            if (cmdletContext.WebsiteConfiguration_IndexDocumentSuffix != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_IndexDocumentSuffix = cmdletContext.WebsiteConfiguration_IndexDocumentSuffix;
            }
            if (requestWebsiteConfiguration_websiteConfiguration_IndexDocumentSuffix != null)
            {
                request.WebsiteConfiguration.IndexDocumentSuffix = requestWebsiteConfiguration_websiteConfiguration_IndexDocumentSuffix;
                requestWebsiteConfigurationIsNull = false;
            }
            List <Amazon.S3.Model.RoutingRule> requestWebsiteConfiguration_websiteConfiguration_RoutingRule = null;

            if (cmdletContext.WebsiteConfiguration_RoutingRule != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RoutingRule = cmdletContext.WebsiteConfiguration_RoutingRule;
            }
            if (requestWebsiteConfiguration_websiteConfiguration_RoutingRule != null)
            {
                request.WebsiteConfiguration.RoutingRules = requestWebsiteConfiguration_websiteConfiguration_RoutingRule;
                requestWebsiteConfigurationIsNull         = false;
            }
            Amazon.S3.Model.RoutingRuleRedirect requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo = null;

            // populate RedirectAllRequestsTo
            var requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull = true;

            requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo = new Amazon.S3.Model.RoutingRuleRedirect();
            System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HostName = null;
            if (cmdletContext.RedirectAllRequestsTo_HostName != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HostName = cmdletContext.RedirectAllRequestsTo_HostName;
            }
            if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HostName != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.HostName = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HostName;
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull    = false;
            }
            System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HttpRedirectCode = null;
            if (cmdletContext.RedirectAllRequestsTo_HttpRedirectCode != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HttpRedirectCode = cmdletContext.RedirectAllRequestsTo_HttpRedirectCode;
            }
            if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HttpRedirectCode != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.HttpRedirectCode = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HttpRedirectCode;
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull            = false;
            }
            System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_Protocol = null;
            if (cmdletContext.RedirectAllRequestsTo_Protocol != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_Protocol = cmdletContext.RedirectAllRequestsTo_Protocol;
            }
            if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_Protocol != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.Protocol = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_Protocol;
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull    = false;
            }
            System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyPrefixWith = null;
            if (cmdletContext.RedirectAllRequestsTo_ReplaceKeyPrefixWith != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyPrefixWith = cmdletContext.RedirectAllRequestsTo_ReplaceKeyPrefixWith;
            }
            if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyPrefixWith != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.ReplaceKeyPrefixWith = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyPrefixWith;
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull = false;
            }
            System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyWith = null;
            if (cmdletContext.RedirectAllRequestsTo_ReplaceKeyWith != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyWith = cmdletContext.RedirectAllRequestsTo_ReplaceKeyWith;
            }
            if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyWith != null)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.ReplaceKeyWith = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyWith;
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull          = false;
            }
            // determine if requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo should be set to null
            if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull)
            {
                requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo = null;
            }
            if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo != null)
            {
                request.WebsiteConfiguration.RedirectAllRequestsTo = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo;
                requestWebsiteConfigurationIsNull = false;
            }
            // determine if request.WebsiteConfiguration should be set to null
            if (requestWebsiteConfigurationIsNull)
            {
                request.WebsiteConfiguration = null;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
Пример #5
0
 public RoutingRule WithRedirect(RoutingRuleRedirect redirect)
 {
     this._redirect = redirect;
     return(this);
 }