Example #1
0
 private Amazon.EKS.Model.AssociateIdentityProviderConfigResponse CallAWSServiceOperation(IAmazonEKS client, Amazon.EKS.Model.AssociateIdentityProviderConfigRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Container Service for Kubernetes", "AssociateIdentityProviderConfig");
     try
     {
         #if DESKTOP
         return(client.AssociateIdentityProviderConfig(request));
         #elif CORECLR
         return(client.AssociateIdentityProviderConfigAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
Example #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EKS.Model.AssociateIdentityProviderConfigRequest();

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

            // populate Oidc
            var requestOidcIsNull = true;

            request.Oidc = new Amazon.EKS.Model.OidcIdentityProviderConfigRequest();
            System.String requestOidc_oidc_ClientId = null;
            if (cmdletContext.Oidc_ClientId != null)
            {
                requestOidc_oidc_ClientId = cmdletContext.Oidc_ClientId;
            }
            if (requestOidc_oidc_ClientId != null)
            {
                request.Oidc.ClientId = requestOidc_oidc_ClientId;
                requestOidcIsNull     = false;
            }
            System.String requestOidc_oidc_GroupsClaim = null;
            if (cmdletContext.Oidc_GroupsClaim != null)
            {
                requestOidc_oidc_GroupsClaim = cmdletContext.Oidc_GroupsClaim;
            }
            if (requestOidc_oidc_GroupsClaim != null)
            {
                request.Oidc.GroupsClaim = requestOidc_oidc_GroupsClaim;
                requestOidcIsNull        = false;
            }
            System.String requestOidc_oidc_GroupsPrefix = null;
            if (cmdletContext.Oidc_GroupsPrefix != null)
            {
                requestOidc_oidc_GroupsPrefix = cmdletContext.Oidc_GroupsPrefix;
            }
            if (requestOidc_oidc_GroupsPrefix != null)
            {
                request.Oidc.GroupsPrefix = requestOidc_oidc_GroupsPrefix;
                requestOidcIsNull         = false;
            }
            System.String requestOidc_oidc_IdentityProviderConfigName = null;
            if (cmdletContext.Oidc_IdentityProviderConfigName != null)
            {
                requestOidc_oidc_IdentityProviderConfigName = cmdletContext.Oidc_IdentityProviderConfigName;
            }
            if (requestOidc_oidc_IdentityProviderConfigName != null)
            {
                request.Oidc.IdentityProviderConfigName = requestOidc_oidc_IdentityProviderConfigName;
                requestOidcIsNull = false;
            }
            System.String requestOidc_oidc_IssuerUrl = null;
            if (cmdletContext.Oidc_IssuerUrl != null)
            {
                requestOidc_oidc_IssuerUrl = cmdletContext.Oidc_IssuerUrl;
            }
            if (requestOidc_oidc_IssuerUrl != null)
            {
                request.Oidc.IssuerUrl = requestOidc_oidc_IssuerUrl;
                requestOidcIsNull      = false;
            }
            Dictionary <System.String, System.String> requestOidc_oidc_RequiredClaim = null;

            if (cmdletContext.Oidc_RequiredClaim != null)
            {
                requestOidc_oidc_RequiredClaim = cmdletContext.Oidc_RequiredClaim;
            }
            if (requestOidc_oidc_RequiredClaim != null)
            {
                request.Oidc.RequiredClaims = requestOidc_oidc_RequiredClaim;
                requestOidcIsNull           = false;
            }
            System.String requestOidc_oidc_UsernameClaim = null;
            if (cmdletContext.Oidc_UsernameClaim != null)
            {
                requestOidc_oidc_UsernameClaim = cmdletContext.Oidc_UsernameClaim;
            }
            if (requestOidc_oidc_UsernameClaim != null)
            {
                request.Oidc.UsernameClaim = requestOidc_oidc_UsernameClaim;
                requestOidcIsNull          = false;
            }
            System.String requestOidc_oidc_UsernamePrefix = null;
            if (cmdletContext.Oidc_UsernamePrefix != null)
            {
                requestOidc_oidc_UsernamePrefix = cmdletContext.Oidc_UsernamePrefix;
            }
            if (requestOidc_oidc_UsernamePrefix != null)
            {
                request.Oidc.UsernamePrefix = requestOidc_oidc_UsernamePrefix;
                requestOidcIsNull           = false;
            }
            // determine if request.Oidc should be set to null
            if (requestOidcIsNull)
            {
                request.Oidc = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }