Exemple #1
0
        /// <summary>
        /// Delete a Client Credential Delete a client credential by its unique client id.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="clientId">ClientId property of the client credentials</param>
        /// <param name="force">Delete immediately (optional)</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <DevOpsVault.SDK.Core.Client.ApiResponse <Object> > DeleteClientCredentialAsyncWithHttpInfo(string clientId, bool?force = default(bool?))
        {
            // verify the required parameter 'clientId' is set
            if (clientId == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'clientId' when calling ClientsApi->DeleteClientCredential");
            }


            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (clientId != null)
            {
                localVarRequestOptions.PathParameters.Add("clientId", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(clientId)); // path parameter
            }
            if (force != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "force", force));
            }

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.DeleteAsync <Object>("/clients/{clientId}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("DeleteClientCredential", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #2
0
        /// <summary>
        /// Get Usage Get usage statistics for API calls and total number of secrets
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="startDate">Start date to get usage statistics</param>
        /// <param name="endDate">End date to get usage statistics, defaults to current date if not set (optional)</param>
        /// <returns>Task of ApiResponse (UsageResponseGeneral)</returns>
        public async System.Threading.Tasks.Task <DevOpsVault.SDK.Core.Client.ApiResponse <UsageResponseGeneral> > GetUsageAsyncWithHttpInfo(string startDate, string endDate = default(string))
        {
            // verify the required parameter 'startDate' is set
            if (startDate == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'startDate' when calling UsageApi->GetUsage");
            }


            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (startDate != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate));
            }
            if (endDate != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate));
            }

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <UsageResponseGeneral>("/usage", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetUsage", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #3
0
        /// <summary>
        /// Restore a Client Restore a client by ID.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="clientId">ClientId property of the client credentials</param>
        /// <returns>ApiResponse of Object(void)</returns>
        public DevOpsVault.SDK.Core.Client.ApiResponse <Object> RestoreClientWithHttpInfo(string clientId)
        {
            // verify the required parameter 'clientId' is set
            if (clientId == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'clientId' when calling ClientsApi->RestoreClient");
            }

            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            var localVarContentType = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (clientId != null)
            {
                localVarRequestOptions.PathParameters.Add("clientId", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(clientId)); // path parameter
            }
            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get <Object>("/clients/{clientId}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("RestoreClient", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #4
0
        /// <summary>
        /// Get background task status Get background task status by task uuid
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">Task status uuid</param>
        /// <returns>Task of ApiResponse (TaskState)</returns>
        public async System.Threading.Tasks.Task <DevOpsVault.SDK.Core.Client.ApiResponse <TaskState> > GetTaskStatusAsyncWithHttpInfo(string id)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'id' when calling TasksApi->GetTaskStatus");
            }


            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (id != null)
            {
                localVarRequestOptions.PathParameters.Add("id", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(id)); // path parameter
            }
            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <TaskState>("/task/status/{id}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetTaskStatus", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
        /// <summary>
        /// Revoke Refresh Token Revoke an existing refresh token to prevent it from being used for authentication.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="refreshtoken">Refresh token to revoke</param>
        /// <returns>ApiResponse of Object(void)</returns>
        public DevOpsVault.SDK.Core.Client.ApiResponse <Object> RevokeWithHttpInfo(string refreshtoken)
        {
            // verify the required parameter 'refreshtoken' is set
            if (refreshtoken == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'refreshtoken' when calling TokensApi->Revoke");
            }

            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            var localVarContentType = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (refreshtoken != null)
            {
                localVarRequestOptions.PathParameters.Add("refreshtoken", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(refreshtoken)); // path parameter
            }
            // make the HTTP request
            var localVarResponse = this.Client.Post <Object>("/revoke/{refreshtoken}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Revoke", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #6
0
        /// <summary>
        /// Create a signed certificate Create and return a signed certificate based on a registered root CA.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"> (optional)</param>
        /// <returns>ApiResponse of ResponseCertificate</returns>
        public DevOpsVault.SDK.Core.Client.ApiResponse <ResponseCertificate> SignCertificateWithHttpInfo(SigningRequest body = default(SigningRequest))
        {
            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            var localVarContentType = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = body;

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Post <ResponseCertificate>("/pki/sign", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("SignCertificate", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
        /// <summary>
        /// Revoke Refresh Token Revoke an existing refresh token to prevent it from being used for authentication.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="refreshtoken">Refresh token to revoke</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <DevOpsVault.SDK.Core.Client.ApiResponse <Object> > RevokeAsyncWithHttpInfo(string refreshtoken)
        {
            // verify the required parameter 'refreshtoken' is set
            if (refreshtoken == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'refreshtoken' when calling TokensApi->Revoke");
            }


            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (refreshtoken != null)
            {
                localVarRequestOptions.PathParameters.Add("refreshtoken", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(refreshtoken)); // path parameter
            }
            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <Object>("/revoke/{refreshtoken}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Revoke", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
        /// <summary>
        /// Get Config By Version Get zero or more representations of config specified by version number.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="version">Versions to return</param>
        /// <returns>ApiResponse of ConfigVersionResponse</returns>
        public DevOpsVault.SDK.Core.Client.ApiResponse <ConfigVersionResponse> GetConfigByVersionWithHttpInfo(long version)
        {
            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            var localVarContentType = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.PathParameters.Add("version", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(version)); // path parameter

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get <ConfigVersionResponse>("/config/version/{version}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetConfigByVersion", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #9
0
        /// <summary>
        /// Create a signed certificate Create and return a signed certificate based on a registered root CA.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"> (optional)</param>
        /// <returns>Task of ApiResponse (ResponseCertificate)</returns>
        public async System.Threading.Tasks.Task <DevOpsVault.SDK.Core.Client.ApiResponse <ResponseCertificate> > SignCertificateAsyncWithHttpInfo(SigningRequest body = default(SigningRequest))
        {
            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            localVarRequestOptions.Data = body;

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <ResponseCertificate>("/pki/sign", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("SignCertificate", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #10
0
        /// <summary>
        /// Get Config By Version Get zero or more representations of config specified by version number.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="version">Versions to return</param>
        /// <returns>Task of ApiResponse (ConfigVersionResponse)</returns>
        public async System.Threading.Tasks.Task <DevOpsVault.SDK.Core.Client.ApiResponse <ConfigVersionResponse> > GetConfigByVersionAsyncWithHttpInfo(long version)
        {
            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            localVarRequestOptions.PathParameters.Add("version", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(version)); // path parameter

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <ConfigVersionResponse>("/config/version/{version}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetConfigByVersion", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #11
0
        /// <summary>
        /// Search for Client Credentials Search for one or more client credentials associated with a particular role.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="role">Role name associated with client credentials</param>
        /// <param name="limit">The maximum number of results per cursor (optional)</param>
        /// <param name="cursor">Cursor to next batch of results (optional)</param>
        /// <returns>Task of ApiResponse (ClientSearchModel)</returns>
        public async System.Threading.Tasks.Task <DevOpsVault.SDK.Core.Client.ApiResponse <ClientSearchModel> > SearchClientsAsyncWithHttpInfo(string role, long?limit = default(long?), string cursor = default(string))
        {
            // verify the required parameter 'role' is set
            if (role == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'role' when calling ClientsApi->SearchClients");
            }


            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (role != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "role", role));
            }
            if (limit != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "limit", limit));
            }
            if (cursor != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "cursor", cursor));
            }

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <ClientSearchModel>("/clients", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("SearchClients", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #12
0
        /// <summary>
        /// Authenticate Submit parameters to get a new access token for use on protected endpoints
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="grantType"></param>
        /// <param name="username">Username for password grant type (optional)</param>
        /// <param name="password">Password for password grant type (optional)</param>
        /// <param name="provider">Provider name for password grant flow for Thycotic One authentication (optional)</param>
        /// <param name="awsBody">Base64 encoded signed aws request body for aws_iam grant type (optional)</param>
        /// <param name="awsHeaders">Base64 encoded signed aws request headers for aws_iam grant type (optional)</param>
        /// <param name="jwt">JWT token for azure and gcp grant types (optional)</param>
        /// <param name="clientId">Client id for client_credentials grant type (optional)</param>
        /// <param name="clientSecret">Client secret for client_credentials grant type (optional)</param>
        /// <param name="refreshToken">Previously issued refresh token for the refresh_token grant type (optional)</param>
        /// <returns>Task of ApiResponse (AccessTokenResponse)</returns>
        public async System.Threading.Tasks.Task <DevOpsVault.SDK.Core.Client.ApiResponse <AccessTokenResponse> > TokenAsyncWithHttpInfo(string grantType, string username = default(string), string password = default(string), string provider = default(string), string awsBody = default(string), string awsHeaders = default(string), string jwt = default(string), string clientId = default(string), string clientSecret = default(string), string refreshToken = default(string))
        {
            // verify the required parameter 'grantType' is set
            if (grantType == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'grantType' when calling TokensApi->Token");
            }


            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/x-www-form-urlencoded"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (grantType != null)
            {
                localVarRequestOptions.FormParameters.Add("grant_type", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(grantType)); // form parameter
            }
            if (username != null)
            {
                localVarRequestOptions.FormParameters.Add("username", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(username)); // form parameter
            }
            if (password != null)
            {
                localVarRequestOptions.FormParameters.Add("password", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(password)); // form parameter
            }
            if (provider != null)
            {
                localVarRequestOptions.FormParameters.Add("provider", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(provider)); // form parameter
            }
            if (awsBody != null)
            {
                localVarRequestOptions.FormParameters.Add("aws_body", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(awsBody)); // form parameter
            }
            if (awsHeaders != null)
            {
                localVarRequestOptions.FormParameters.Add("aws_headers", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(awsHeaders)); // form parameter
            }
            if (jwt != null)
            {
                localVarRequestOptions.FormParameters.Add("jwt", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(jwt)); // form parameter
            }
            if (clientId != null)
            {
                localVarRequestOptions.FormParameters.Add("client_id", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(clientId)); // form parameter
            }
            if (clientSecret != null)
            {
                localVarRequestOptions.FormParameters.Add("client_secret", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(clientSecret)); // form parameter
            }
            if (refreshToken != null)
            {
                localVarRequestOptions.FormParameters.Add("refresh_token", DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToString(refreshToken)); // form parameter
            }


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <AccessTokenResponse>("/token", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Token", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #13
0
        /// <summary>
        /// Find Audit Records Find audit records based on search critera.
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="principal">Security principal name (optional)</param>
        /// <param name="startDate">The start date to find audits from (optional)</param>
        /// <param name="endDate">The end date to find audits to (optional)</param>
        /// <param name="action">The audit action (optional)</param>
        /// <param name="path">The secret path (optional)</param>
        /// <param name="cursor">The cursor for pagination (optional)</param>
        /// <param name="limit">The number of results to return (optional)</param>
        /// <returns>Task of ApiResponse (LogSearchResponse)</returns>
        public async System.Threading.Tasks.Task <DevOpsVault.SDK.Core.Client.ApiResponse <LogSearchResponse> > FindAuditAsyncWithHttpInfo(string principal = default(string), DateTime?startDate = default(DateTime?), DateTime?endDate = default(DateTime?), string action = default(string), string path = default(string), string cursor = default(string), long?limit = default(long?))
        {
            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (principal != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "principal", principal));
            }
            if (startDate != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate));
            }
            if (endDate != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate));
            }
            if (action != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "action", action));
            }
            if (path != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "path", path));
            }
            if (cursor != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "cursor", cursor));
            }
            if (limit != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "limit", limit));
            }

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <LogSearchResponse>("/audit", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("FindAudit", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #14
0
        /// <summary>
        /// Download Audit Records Download a zip of audit records for a time range
        /// </summary>
        /// <exception cref="DevOpsVault.SDK.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="startDate">The start date to find audits from</param>
        /// <param name="endDate">The end date to find audits to</param>
        /// <returns>ApiResponse of System.IO.Stream</returns>
        public DevOpsVault.SDK.Core.Client.ApiResponse <System.IO.Stream> DownloadAuditWithHttpInfo(string startDate, string endDate)
        {
            // verify the required parameter 'startDate' is set
            if (startDate == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'startDate' when calling AuditApi->DownloadAudit");
            }

            // verify the required parameter 'endDate' is set
            if (endDate == null)
            {
                throw new DevOpsVault.SDK.Core.Client.ApiException(400, "Missing required parameter 'endDate' when calling AuditApi->DownloadAudit");
            }

            DevOpsVault.SDK.Core.Client.RequestOptions localVarRequestOptions = new DevOpsVault.SDK.Core.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/zip"
            };

            var localVarContentType = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = DevOpsVault.SDK.Core.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (startDate != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate));
            }
            if (endDate != null)
            {
                localVarRequestOptions.QueryParameters.Add(DevOpsVault.SDK.Core.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate));
            }

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get <System.IO.Stream>("/download/audit", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("DownloadAudit", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }