Exemplo n.º 1
0
 private Amazon.SageMaker.Model.CreateWorkforceResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreateWorkforceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreateWorkforce");
     try
     {
         #if DESKTOP
         return(client.CreateWorkforce(request));
         #elif CORECLR
         return(client.CreateWorkforceAsync(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;
     }
 }
Exemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SageMaker.Model.CreateWorkforceRequest();


            // populate CognitoConfig
            var requestCognitoConfigIsNull = true;

            request.CognitoConfig = new Amazon.SageMaker.Model.CognitoConfig();
            System.String requestCognitoConfig_cognitoConfig_ClientId = null;
            if (cmdletContext.CognitoConfig_ClientId != null)
            {
                requestCognitoConfig_cognitoConfig_ClientId = cmdletContext.CognitoConfig_ClientId;
            }
            if (requestCognitoConfig_cognitoConfig_ClientId != null)
            {
                request.CognitoConfig.ClientId = requestCognitoConfig_cognitoConfig_ClientId;
                requestCognitoConfigIsNull     = false;
            }
            System.String requestCognitoConfig_cognitoConfig_UserPool = null;
            if (cmdletContext.CognitoConfig_UserPool != null)
            {
                requestCognitoConfig_cognitoConfig_UserPool = cmdletContext.CognitoConfig_UserPool;
            }
            if (requestCognitoConfig_cognitoConfig_UserPool != null)
            {
                request.CognitoConfig.UserPool = requestCognitoConfig_cognitoConfig_UserPool;
                requestCognitoConfigIsNull     = false;
            }
            // determine if request.CognitoConfig should be set to null
            if (requestCognitoConfigIsNull)
            {
                request.CognitoConfig = null;
            }

            // populate OidcConfig
            var requestOidcConfigIsNull = true;

            request.OidcConfig = new Amazon.SageMaker.Model.OidcConfig();
            System.String requestOidcConfig_oidcConfig_AuthorizationEndpoint = null;
            if (cmdletContext.OidcConfig_AuthorizationEndpoint != null)
            {
                requestOidcConfig_oidcConfig_AuthorizationEndpoint = cmdletContext.OidcConfig_AuthorizationEndpoint;
            }
            if (requestOidcConfig_oidcConfig_AuthorizationEndpoint != null)
            {
                request.OidcConfig.AuthorizationEndpoint = requestOidcConfig_oidcConfig_AuthorizationEndpoint;
                requestOidcConfigIsNull = false;
            }
            System.String requestOidcConfig_oidcConfig_ClientId = null;
            if (cmdletContext.OidcConfig_ClientId != null)
            {
                requestOidcConfig_oidcConfig_ClientId = cmdletContext.OidcConfig_ClientId;
            }
            if (requestOidcConfig_oidcConfig_ClientId != null)
            {
                request.OidcConfig.ClientId = requestOidcConfig_oidcConfig_ClientId;
                requestOidcConfigIsNull     = false;
            }
            System.String requestOidcConfig_oidcConfig_ClientSecret = null;
            if (cmdletContext.OidcConfig_ClientSecret != null)
            {
                requestOidcConfig_oidcConfig_ClientSecret = cmdletContext.OidcConfig_ClientSecret;
            }
            if (requestOidcConfig_oidcConfig_ClientSecret != null)
            {
                request.OidcConfig.ClientSecret = requestOidcConfig_oidcConfig_ClientSecret;
                requestOidcConfigIsNull         = false;
            }
            System.String requestOidcConfig_oidcConfig_Issuer = null;
            if (cmdletContext.OidcConfig_Issuer != null)
            {
                requestOidcConfig_oidcConfig_Issuer = cmdletContext.OidcConfig_Issuer;
            }
            if (requestOidcConfig_oidcConfig_Issuer != null)
            {
                request.OidcConfig.Issuer = requestOidcConfig_oidcConfig_Issuer;
                requestOidcConfigIsNull   = false;
            }
            System.String requestOidcConfig_oidcConfig_JwksUri = null;
            if (cmdletContext.OidcConfig_JwksUri != null)
            {
                requestOidcConfig_oidcConfig_JwksUri = cmdletContext.OidcConfig_JwksUri;
            }
            if (requestOidcConfig_oidcConfig_JwksUri != null)
            {
                request.OidcConfig.JwksUri = requestOidcConfig_oidcConfig_JwksUri;
                requestOidcConfigIsNull    = false;
            }
            System.String requestOidcConfig_oidcConfig_LogoutEndpoint = null;
            if (cmdletContext.OidcConfig_LogoutEndpoint != null)
            {
                requestOidcConfig_oidcConfig_LogoutEndpoint = cmdletContext.OidcConfig_LogoutEndpoint;
            }
            if (requestOidcConfig_oidcConfig_LogoutEndpoint != null)
            {
                request.OidcConfig.LogoutEndpoint = requestOidcConfig_oidcConfig_LogoutEndpoint;
                requestOidcConfigIsNull           = false;
            }
            System.String requestOidcConfig_oidcConfig_TokenEndpoint = null;
            if (cmdletContext.OidcConfig_TokenEndpoint != null)
            {
                requestOidcConfig_oidcConfig_TokenEndpoint = cmdletContext.OidcConfig_TokenEndpoint;
            }
            if (requestOidcConfig_oidcConfig_TokenEndpoint != null)
            {
                request.OidcConfig.TokenEndpoint = requestOidcConfig_oidcConfig_TokenEndpoint;
                requestOidcConfigIsNull          = false;
            }
            System.String requestOidcConfig_oidcConfig_UserInfoEndpoint = null;
            if (cmdletContext.OidcConfig_UserInfoEndpoint != null)
            {
                requestOidcConfig_oidcConfig_UserInfoEndpoint = cmdletContext.OidcConfig_UserInfoEndpoint;
            }
            if (requestOidcConfig_oidcConfig_UserInfoEndpoint != null)
            {
                request.OidcConfig.UserInfoEndpoint = requestOidcConfig_oidcConfig_UserInfoEndpoint;
                requestOidcConfigIsNull             = false;
            }
            // determine if request.OidcConfig should be set to null
            if (requestOidcConfigIsNull)
            {
                request.OidcConfig = null;
            }

            // populate SourceIpConfig
            var requestSourceIpConfigIsNull = true;

            request.SourceIpConfig = new Amazon.SageMaker.Model.SourceIpConfig();
            List <System.String> requestSourceIpConfig_sourceIpConfig_Cidr = null;

            if (cmdletContext.SourceIpConfig_Cidr != null)
            {
                requestSourceIpConfig_sourceIpConfig_Cidr = cmdletContext.SourceIpConfig_Cidr;
            }
            if (requestSourceIpConfig_sourceIpConfig_Cidr != null)
            {
                request.SourceIpConfig.Cidrs = requestSourceIpConfig_sourceIpConfig_Cidr;
                requestSourceIpConfigIsNull  = false;
            }
            // determine if request.SourceIpConfig should be set to null
            if (requestSourceIpConfigIsNull)
            {
                request.SourceIpConfig = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.WorkforceName != null)
            {
                request.WorkforceName = cmdletContext.WorkforceName;
            }

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