lib/aws-sdk-codegurureviewer/client.rb in aws-sdk-codegurureviewer-1.17.0 vs lib/aws-sdk-codegurureviewer/client.rb in aws-sdk-codegurureviewer-1.18.0

- old
+ new

@@ -333,13 +333,13 @@ # in the repository's pull requests and provides automatic # recommendations. You can view recommendations using the CodeGuru # Reviewer console. For more information, see [Recommendations in Amazon # CodeGuru Reviewer][1] in the *Amazon CodeGuru Reviewer User Guide.* # - # If you associate a CodeCommit repository, it must be in the same AWS - # Region and AWS account where its CodeGuru Reviewer code reviews are - # configured. + # If you associate a CodeCommit or S3 repository, it must be in the same + # AWS Region and AWS account where its CodeGuru Reviewer code reviews + # are configured. # # Bitbucket and GitHub Enterprise Server repositories are managed by AWS # CodeStar Connections to connect to CodeGuru Reviewer. For more # information, see [Associate a repository][2] in the *Amazon CodeGuru # Reviewer User Guide.* @@ -411,10 +411,14 @@ # git_hub_enterprise_server: { # name: "Name", # required # connection_arn: "ConnectionArn", # required # owner: "Owner", # required # }, + # s3_bucket: { + # name: "Name", # required + # bucket_name: "S3BucketName", # required + # }, # }, # client_request_token: "ClientRequestToken", # tags: { # "TagKey" => "TagValue", # }, @@ -429,17 +433,20 @@ # resp.repository_association.association_id #=> String # resp.repository_association.association_arn #=> String # resp.repository_association.connection_arn #=> String # resp.repository_association.name #=> String # resp.repository_association.owner #=> String - # resp.repository_association.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer" + # resp.repository_association.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer", "S3Bucket" # resp.repository_association.state #=> String, one of "Associated", "Associating", "Failed", "Disassociating", "Disassociated" # resp.repository_association.state_reason #=> String # resp.repository_association.last_updated_time_stamp #=> Time # resp.repository_association.created_time_stamp #=> Time # resp.repository_association.kms_key_details.kms_key_id #=> String # resp.repository_association.kms_key_details.encryption_option #=> String, one of "AWS_OWNED_CMK", "CUSTOMER_MANAGED_CMK" + # resp.repository_association.s3_repository_details.bucket_name #=> String + # resp.repository_association.s3_repository_details.code_artifacts.source_code_artifacts_object_key #=> String + # resp.repository_association.s3_repository_details.code_artifacts.build_artifacts_object_key #=> String # resp.tags #=> Hash # resp.tags["TagKey"] #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/codeguru-reviewer-2019-09-19/AssociateRepository AWS API Documentation # @@ -451,12 +458,11 @@ end # Use to create a code review with a [ `CodeReviewType` ][1] of # `RepositoryAnalysis`. This type of code review analyzes all code under # a specified branch in an associated repository. `PullRequest` code - # reviews are automatically triggered by a pull request so cannot be - # created using this method. + # reviews are automatically triggered by a pull request. # # # # [1]: https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReviewType.html # @@ -502,37 +508,85 @@ # resp = client.create_code_review({ # name: "CodeReviewName", # required # repository_association_arn: "AssociationArn", # required # type: { # required # repository_analysis: { # required - # repository_head: { # required + # repository_head: { # branch_name: "BranchName", # required # }, + # source_code_type: { + # commit_diff: { + # source_commit: "CommitId", + # destination_commit: "CommitId", + # merge_base_commit: "CommitId", + # }, + # repository_head: { + # branch_name: "BranchName", # required + # }, + # branch_diff: { + # source_branch_name: "BranchName", # required + # destination_branch_name: "BranchName", # required + # }, + # s3_bucket_repository: { + # name: "Name", # required + # details: { + # bucket_name: "S3BucketName", + # code_artifacts: { + # source_code_artifacts_object_key: "SourceCodeArtifactsObjectKey", # required + # build_artifacts_object_key: "BuildArtifactsObjectKey", + # }, + # }, + # }, + # request_metadata: { + # request_id: "RequestId", + # requester: "Requester", + # event_info: { + # name: "EventName", + # state: "EventState", + # }, + # vendor_name: "GitHub", # accepts GitHub, GitLab, NativeS3 + # }, + # }, # }, + # analysis_types: ["Security"], # accepts Security, CodeQuality # }, # client_request_token: "ClientRequestToken", # }) # # @example Response structure # # resp.code_review.name #=> String # resp.code_review.code_review_arn #=> String # resp.code_review.repository_name #=> String # resp.code_review.owner #=> String - # resp.code_review.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer" + # resp.code_review.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer", "S3Bucket" # resp.code_review.state #=> String, one of "Completed", "Pending", "Failed", "Deleting" # resp.code_review.state_reason #=> String # resp.code_review.created_time_stamp #=> Time # resp.code_review.last_updated_time_stamp #=> Time # resp.code_review.type #=> String, one of "PullRequest", "RepositoryAnalysis" # resp.code_review.pull_request_id #=> String # resp.code_review.source_code_type.commit_diff.source_commit #=> String # resp.code_review.source_code_type.commit_diff.destination_commit #=> String + # resp.code_review.source_code_type.commit_diff.merge_base_commit #=> String # resp.code_review.source_code_type.repository_head.branch_name #=> String + # resp.code_review.source_code_type.branch_diff.source_branch_name #=> String + # resp.code_review.source_code_type.branch_diff.destination_branch_name #=> String + # resp.code_review.source_code_type.s3_bucket_repository.name #=> String + # resp.code_review.source_code_type.s3_bucket_repository.details.bucket_name #=> String + # resp.code_review.source_code_type.s3_bucket_repository.details.code_artifacts.source_code_artifacts_object_key #=> String + # resp.code_review.source_code_type.s3_bucket_repository.details.code_artifacts.build_artifacts_object_key #=> String + # resp.code_review.source_code_type.request_metadata.request_id #=> String + # resp.code_review.source_code_type.request_metadata.requester #=> String + # resp.code_review.source_code_type.request_metadata.event_info.name #=> String + # resp.code_review.source_code_type.request_metadata.event_info.state #=> String + # resp.code_review.source_code_type.request_metadata.vendor_name #=> String, one of "GitHub", "GitLab", "NativeS3" # resp.code_review.association_arn #=> String # resp.code_review.metrics.metered_lines_of_code_count #=> Integer # resp.code_review.metrics.findings_count #=> Integer + # resp.code_review.analysis_types #=> Array + # resp.code_review.analysis_types[0] #=> String, one of "Security", "CodeQuality" # # @see http://docs.aws.amazon.com/goto/WebAPI/codeguru-reviewer-2019-09-19/CreateCodeReview AWS API Documentation # # @overload create_code_review(params = {}) # @param [Hash] params ({}) @@ -565,24 +619,43 @@ # # resp.code_review.name #=> String # resp.code_review.code_review_arn #=> String # resp.code_review.repository_name #=> String # resp.code_review.owner #=> String - # resp.code_review.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer" + # resp.code_review.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer", "S3Bucket" # resp.code_review.state #=> String, one of "Completed", "Pending", "Failed", "Deleting" # resp.code_review.state_reason #=> String # resp.code_review.created_time_stamp #=> Time # resp.code_review.last_updated_time_stamp #=> Time # resp.code_review.type #=> String, one of "PullRequest", "RepositoryAnalysis" # resp.code_review.pull_request_id #=> String # resp.code_review.source_code_type.commit_diff.source_commit #=> String # resp.code_review.source_code_type.commit_diff.destination_commit #=> String + # resp.code_review.source_code_type.commit_diff.merge_base_commit #=> String # resp.code_review.source_code_type.repository_head.branch_name #=> String + # resp.code_review.source_code_type.branch_diff.source_branch_name #=> String + # resp.code_review.source_code_type.branch_diff.destination_branch_name #=> String + # resp.code_review.source_code_type.s3_bucket_repository.name #=> String + # resp.code_review.source_code_type.s3_bucket_repository.details.bucket_name #=> String + # resp.code_review.source_code_type.s3_bucket_repository.details.code_artifacts.source_code_artifacts_object_key #=> String + # resp.code_review.source_code_type.s3_bucket_repository.details.code_artifacts.build_artifacts_object_key #=> String + # resp.code_review.source_code_type.request_metadata.request_id #=> String + # resp.code_review.source_code_type.request_metadata.requester #=> String + # resp.code_review.source_code_type.request_metadata.event_info.name #=> String + # resp.code_review.source_code_type.request_metadata.event_info.state #=> String + # resp.code_review.source_code_type.request_metadata.vendor_name #=> String, one of "GitHub", "GitLab", "NativeS3" # resp.code_review.association_arn #=> String # resp.code_review.metrics.metered_lines_of_code_count #=> Integer # resp.code_review.metrics.findings_count #=> Integer + # resp.code_review.analysis_types #=> Array + # resp.code_review.analysis_types[0] #=> String, one of "Security", "CodeQuality" # + # + # The following waiters are defined for this operation (see {Client#wait_until} for detailed usage): + # + # * code_review_completed + # # @see http://docs.aws.amazon.com/goto/WebAPI/codeguru-reviewer-2019-09-19/DescribeCodeReview AWS API Documentation # # @overload describe_code_review(params = {}) # @param [Hash] params ({}) def describe_code_review(params = {}, options = {}) @@ -681,20 +754,28 @@ # resp.repository_association.association_id #=> String # resp.repository_association.association_arn #=> String # resp.repository_association.connection_arn #=> String # resp.repository_association.name #=> String # resp.repository_association.owner #=> String - # resp.repository_association.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer" + # resp.repository_association.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer", "S3Bucket" # resp.repository_association.state #=> String, one of "Associated", "Associating", "Failed", "Disassociating", "Disassociated" # resp.repository_association.state_reason #=> String # resp.repository_association.last_updated_time_stamp #=> Time # resp.repository_association.created_time_stamp #=> Time # resp.repository_association.kms_key_details.kms_key_id #=> String # resp.repository_association.kms_key_details.encryption_option #=> String, one of "AWS_OWNED_CMK", "CUSTOMER_MANAGED_CMK" + # resp.repository_association.s3_repository_details.bucket_name #=> String + # resp.repository_association.s3_repository_details.code_artifacts.source_code_artifacts_object_key #=> String + # resp.repository_association.s3_repository_details.code_artifacts.build_artifacts_object_key #=> String # resp.tags #=> Hash # resp.tags["TagKey"] #=> String # + # + # The following waiters are defined for this operation (see {Client#wait_until} for detailed usage): + # + # * repository_association_succeeded + # # @see http://docs.aws.amazon.com/goto/WebAPI/codeguru-reviewer-2019-09-19/DescribeRepositoryAssociation AWS API Documentation # # @overload describe_repository_association(params = {}) # @param [Hash] params ({}) def describe_repository_association(params = {}, options = {}) @@ -731,17 +812,20 @@ # resp.repository_association.association_id #=> String # resp.repository_association.association_arn #=> String # resp.repository_association.connection_arn #=> String # resp.repository_association.name #=> String # resp.repository_association.owner #=> String - # resp.repository_association.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer" + # resp.repository_association.provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer", "S3Bucket" # resp.repository_association.state #=> String, one of "Associated", "Associating", "Failed", "Disassociating", "Disassociated" # resp.repository_association.state_reason #=> String # resp.repository_association.last_updated_time_stamp #=> Time # resp.repository_association.created_time_stamp #=> Time # resp.repository_association.kms_key_details.kms_key_id #=> String # resp.repository_association.kms_key_details.encryption_option #=> String, one of "AWS_OWNED_CMK", "CUSTOMER_MANAGED_CMK" + # resp.repository_association.s3_repository_details.bucket_name #=> String + # resp.repository_association.s3_repository_details.code_artifacts.source_code_artifacts_object_key #=> String + # resp.repository_association.s3_repository_details.code_artifacts.build_artifacts_object_key #=> String # resp.tags #=> Hash # resp.tags["TagKey"] #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/codeguru-reviewer-2019-09-19/DisassociateRepository AWS API Documentation # @@ -800,11 +884,11 @@ # The returned {Seahorse::Client::Response response} is a pageable response and is Enumerable. For details on usage see {Aws::PageableResponse PageableResponse}. # # @example Request syntax with placeholder values # # resp = client.list_code_reviews({ - # provider_types: ["CodeCommit"], # accepts CodeCommit, GitHub, Bitbucket, GitHubEnterpriseServer + # provider_types: ["CodeCommit"], # accepts CodeCommit, GitHub, Bitbucket, GitHubEnterpriseServer, S3Bucket # states: ["Completed"], # accepts Completed, Pending, Failed, Deleting # repository_names: ["Name"], # type: "PullRequest", # required, accepts PullRequest, RepositoryAnalysis # max_results: 1, # next_token: "NextToken", @@ -815,18 +899,33 @@ # resp.code_review_summaries #=> Array # resp.code_review_summaries[0].name #=> String # resp.code_review_summaries[0].code_review_arn #=> String # resp.code_review_summaries[0].repository_name #=> String # resp.code_review_summaries[0].owner #=> String - # resp.code_review_summaries[0].provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer" + # resp.code_review_summaries[0].provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer", "S3Bucket" # resp.code_review_summaries[0].state #=> String, one of "Completed", "Pending", "Failed", "Deleting" # resp.code_review_summaries[0].created_time_stamp #=> Time # resp.code_review_summaries[0].last_updated_time_stamp #=> Time # resp.code_review_summaries[0].type #=> String, one of "PullRequest", "RepositoryAnalysis" # resp.code_review_summaries[0].pull_request_id #=> String # resp.code_review_summaries[0].metrics_summary.metered_lines_of_code_count #=> Integer # resp.code_review_summaries[0].metrics_summary.findings_count #=> Integer + # resp.code_review_summaries[0].source_code_type.commit_diff.source_commit #=> String + # resp.code_review_summaries[0].source_code_type.commit_diff.destination_commit #=> String + # resp.code_review_summaries[0].source_code_type.commit_diff.merge_base_commit #=> String + # resp.code_review_summaries[0].source_code_type.repository_head.branch_name #=> String + # resp.code_review_summaries[0].source_code_type.branch_diff.source_branch_name #=> String + # resp.code_review_summaries[0].source_code_type.branch_diff.destination_branch_name #=> String + # resp.code_review_summaries[0].source_code_type.s3_bucket_repository.name #=> String + # resp.code_review_summaries[0].source_code_type.s3_bucket_repository.details.bucket_name #=> String + # resp.code_review_summaries[0].source_code_type.s3_bucket_repository.details.code_artifacts.source_code_artifacts_object_key #=> String + # resp.code_review_summaries[0].source_code_type.s3_bucket_repository.details.code_artifacts.build_artifacts_object_key #=> String + # resp.code_review_summaries[0].source_code_type.request_metadata.request_id #=> String + # resp.code_review_summaries[0].source_code_type.request_metadata.requester #=> String + # resp.code_review_summaries[0].source_code_type.request_metadata.event_info.name #=> String + # resp.code_review_summaries[0].source_code_type.request_metadata.event_info.state #=> String + # resp.code_review_summaries[0].source_code_type.request_metadata.vendor_name #=> String, one of "GitHub", "GitLab", "NativeS3" # resp.next_token #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/codeguru-reviewer-2019-09-19/ListCodeReviews AWS API Documentation # # @overload list_code_reviews(params = {}) @@ -949,10 +1048,11 @@ # resp.recommendation_summaries[0].file_path #=> String # resp.recommendation_summaries[0].recommendation_id #=> String # resp.recommendation_summaries[0].start_line #=> Integer # resp.recommendation_summaries[0].end_line #=> Integer # resp.recommendation_summaries[0].description #=> String + # resp.recommendation_summaries[0].recommendation_category #=> String, one of "AWSBestPractices", "AWSCloudFormationIssues", "DuplicateCode", "CodeMaintenanceIssues", "ConcurrencyIssues", "InputValidations", "PythonBestPractices", "JavaBestPractices", "ResourceLeaks", "SecurityIssues" # resp.next_token #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/codeguru-reviewer-2019-09-19/ListRecommendations AWS API Documentation # # @overload list_recommendations(params = {}) @@ -1059,11 +1159,11 @@ # The returned {Seahorse::Client::Response response} is a pageable response and is Enumerable. For details on usage see {Aws::PageableResponse PageableResponse}. # # @example Request syntax with placeholder values # # resp = client.list_repository_associations({ - # provider_types: ["CodeCommit"], # accepts CodeCommit, GitHub, Bitbucket, GitHubEnterpriseServer + # provider_types: ["CodeCommit"], # accepts CodeCommit, GitHub, Bitbucket, GitHubEnterpriseServer, S3Bucket # states: ["Associated"], # accepts Associated, Associating, Failed, Disassociating, Disassociated # names: ["Name"], # owners: ["Owner"], # max_results: 1, # next_token: "NextToken", @@ -1076,11 +1176,11 @@ # resp.repository_association_summaries[0].connection_arn #=> String # resp.repository_association_summaries[0].last_updated_time_stamp #=> Time # resp.repository_association_summaries[0].association_id #=> String # resp.repository_association_summaries[0].name #=> String # resp.repository_association_summaries[0].owner #=> String - # resp.repository_association_summaries[0].provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer" + # resp.repository_association_summaries[0].provider_type #=> String, one of "CodeCommit", "GitHub", "Bitbucket", "GitHubEnterpriseServer", "S3Bucket" # resp.repository_association_summaries[0].state #=> String, one of "Associated", "Associating", "Failed", "Disassociating", "Disassociated" # resp.next_token #=> String # # @see http://docs.aws.amazon.com/goto/WebAPI/codeguru-reviewer-2019-09-19/ListRepositoryAssociations AWS API Documentation # @@ -1255,17 +1355,132 @@ operation: config.api.operation(operation_name), client: self, params: params, config: config) context[:gem_name] = 'aws-sdk-codegurureviewer' - context[:gem_version] = '1.17.0' + context[:gem_version] = '1.18.0' Seahorse::Client::Request.new(handlers, context) end + # Polls an API operation until a resource enters a desired state. + # + # ## Basic Usage + # + # A waiter will call an API operation until: + # + # * It is successful + # * It enters a terminal state + # * It makes the maximum number of attempts + # + # In between attempts, the waiter will sleep. + # + # # polls in a loop, sleeping between attempts + # client.wait_until(waiter_name, params) + # + # ## Configuration + # + # You can configure the maximum number of polling attempts, and the + # delay (in seconds) between each polling attempt. You can pass + # configuration as the final arguments hash. + # + # # poll for ~25 seconds + # client.wait_until(waiter_name, params, { + # max_attempts: 5, + # delay: 5, + # }) + # + # ## Callbacks + # + # You can be notified before each polling attempt and before each + # delay. If you throw `:success` or `:failure` from these callbacks, + # it will terminate the waiter. + # + # started_at = Time.now + # client.wait_until(waiter_name, params, { + # + # # disable max attempts + # max_attempts: nil, + # + # # poll for 1 hour, instead of a number of attempts + # before_wait: -> (attempts, response) do + # throw :failure if Time.now - started_at > 3600 + # end + # }) + # + # ## Handling Errors + # + # When a waiter is unsuccessful, it will raise an error. + # All of the failure errors extend from + # {Aws::Waiters::Errors::WaiterFailed}. + # + # begin + # client.wait_until(...) + # rescue Aws::Waiters::Errors::WaiterFailed + # # resource did not enter the desired state in time + # end + # + # ## Valid Waiters + # + # The following table lists the valid waiter names, the operations they call, + # and the default `:delay` and `:max_attempts` values. + # + # | waiter_name | params | :delay | :max_attempts | + # | -------------------------------- | ---------------------------------------- | -------- | ------------- | + # | code_review_completed | {Client#describe_code_review} | 10 | 60 | + # | repository_association_succeeded | {Client#describe_repository_association} | 10 | 20 | + # + # @raise [Errors::FailureStateError] Raised when the waiter terminates + # because the waiter has entered a state that it will not transition + # out of, preventing success. + # + # @raise [Errors::TooManyAttemptsError] Raised when the configured + # maximum number of attempts have been made, and the waiter is not + # yet successful. + # + # @raise [Errors::UnexpectedError] Raised when an error is encounted + # while polling for a resource that is not expected. + # + # @raise [Errors::NoSuchWaiterError] Raised when you request to wait + # for an unknown state. + # + # @return [Boolean] Returns `true` if the waiter was successful. + # @param [Symbol] waiter_name + # @param [Hash] params ({}) + # @param [Hash] options ({}) + # @option options [Integer] :max_attempts + # @option options [Integer] :delay + # @option options [Proc] :before_attempt + # @option options [Proc] :before_wait + def wait_until(waiter_name, params = {}, options = {}) + w = waiter(waiter_name, options) + yield(w.waiter) if block_given? # deprecated + w.wait(params) + end + # @api private # @deprecated def waiter_names - [] + waiters.keys + end + + private + + # @param [Symbol] waiter_name + # @param [Hash] options ({}) + def waiter(waiter_name, options = {}) + waiter_class = waiters[waiter_name] + if waiter_class + waiter_class.new(options.merge(client: self)) + else + raise Aws::Waiters::Errors::NoSuchWaiterError.new(waiter_name, waiters.keys) + end + end + + def waiters + { + code_review_completed: Waiters::CodeReviewCompleted, + repository_association_succeeded: Waiters::RepositoryAssociationSucceeded + } end class << self # @api private