Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

[AutoPR apimanagement/resource-manager] /identity endpoint added #1907

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,123 @@ def create_or_update_async(resource_group_name, service_name, api_id, issue_id,
promise.execute
end

#
# Updates an existing issue for an API.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param api_id [String] API identifier. Must be unique in the current API
# Management service instance.
# @param issue_id [String] Issue identifier. Must be unique in the current API
# Management service instance.
# @param parameters [IssueUpdateContract] Update parameters.
# @param if_match [String] ETag of the Issue Entity. ETag should match the
# current entity state from the header response of the GET request or it should
# be * for unconditional update.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
#
def update(resource_group_name, service_name, api_id, issue_id, parameters, if_match = nil, custom_headers = nil)
response = update_async(resource_group_name, service_name, api_id, issue_id, parameters, if_match, custom_headers).value!
nil
end

#
# Updates an existing issue for an API.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param api_id [String] API identifier. Must be unique in the current API
# Management service instance.
# @param issue_id [String] Issue identifier. Must be unique in the current API
# Management service instance.
# @param parameters [IssueUpdateContract] Update parameters.
# @param if_match [String] ETag of the Issue Entity. ETag should match the
# current entity state from the header response of the GET request or it should
# be * for unconditional update.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def update_with_http_info(resource_group_name, service_name, api_id, issue_id, parameters, if_match = nil, custom_headers = nil)
update_async(resource_group_name, service_name, api_id, issue_id, parameters, if_match, custom_headers).value!
end

#
# Updates an existing issue for an API.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param api_id [String] API identifier. Must be unique in the current API
# Management service instance.
# @param issue_id [String] Issue identifier. Must be unique in the current API
# Management service instance.
# @param parameters [IssueUpdateContract] Update parameters.
# @param if_match [String] ETag of the Issue Entity. ETag should match the
# current entity state from the header response of the GET request or it should
# be * for unconditional update.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def update_async(resource_group_name, service_name, api_id, issue_id, parameters, if_match = nil, custom_headers = nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'service_name is nil' if service_name.nil?
fail ArgumentError, 'api_id is nil' if api_id.nil?
fail ArgumentError, 'issue_id is nil' if issue_id.nil?
fail ArgumentError, 'parameters is nil' if parameters.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


request_headers = {}

# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['If-Match'] = if_match unless if_match.nil?
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

request_headers['Content-Type'] = 'application/json; charset=utf-8'

# Serialize Request
request_mapper = Azure::ApiManagement::Mgmt::V2018_01_01_preview::Models::IssueUpdateContract.mapper()
request_content = @client.serialize(request_mapper, parameters)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'

request_url = @base_url || @client.base_url

options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'apiId' => api_id,'issueId' => issue_id,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:patch, path_template, options)

promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 204
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end

result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

result
end

promise.execute
end

#
# Deletes the specified Issue from an API.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::ApiManagement::Mgmt::V2018_01_01_preview
module Models
#
# Model object.
#
#
class CurrentUserIdentity

include MsRestAzure

# @return [String] API Management service user id.
attr_accessor :id


#
# Mapper for CurrentUserIdentity class as Ruby Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
required: false,
serialized_name: 'CurrentUserIdentity',
type: {
name: 'Composite',
class_name: 'CurrentUserIdentity',
model_properties: {
id: {
required: false,
serialized_name: 'id',
type: {
name: 'String'
}
}
}
}
}
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ class IssueContract < Resource

include MsRestAzure

# @return [String] The issue title.
attr_accessor :title

# @return [String] Text describing the issue.
attr_accessor :description

# @return [DateTime] Date and time when the issue was created.
attr_accessor :created_date

# @return [State] Status of the issue. Possible values include:
# 'proposed', 'open', 'removed', 'resolved', 'closed'
attr_accessor :state

# @return [String] A resource identifier for the user created the issue.
attr_accessor :user_id

# @return [String] A resource identifier for the API the issue was
# created for.
attr_accessor :api_id

# @return [String] The issue title.
attr_accessor :title

# @return [String] Text describing the issue.
attr_accessor :description

# @return [String] A resource identifier for the user created the issue.
attr_accessor :user_id


#
# Mapper for IssueContract class as Ruby Hash.
Expand Down Expand Up @@ -69,44 +69,44 @@ def self.mapper()
name: 'String'
}
},
title: {
required: true,
serialized_name: 'properties.title',
created_date: {
required: false,
serialized_name: 'properties.createdDate',
type: {
name: 'String'
name: 'DateTime'
}
},
description: {
required: true,
serialized_name: 'properties.description',
state: {
required: false,
serialized_name: 'properties.state',
type: {
name: 'String'
}
},
created_date: {
api_id: {
required: false,
serialized_name: 'properties.createdDate',
serialized_name: 'properties.apiId',
type: {
name: 'DateTime'
name: 'String'
}
},
state: {
required: false,
serialized_name: 'properties.state',
title: {
required: true,
serialized_name: 'properties.title',
type: {
name: 'String'
}
},
user_id: {
description: {
required: true,
serialized_name: 'properties.userId',
serialized_name: 'properties.description',
type: {
name: 'String'
}
},
api_id: {
required: false,
serialized_name: 'properties.apiId',
user_id: {
required: true,
serialized_name: 'properties.userId',
type: {
name: 'String'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::ApiManagement::Mgmt::V2018_01_01_preview
module Models
#
# Issue contract Base Properties.
#
class IssueContractBaseProperties

include MsRestAzure

# @return [DateTime] Date and time when the issue was created.
attr_accessor :created_date

# @return [State] Status of the issue. Possible values include:
# 'proposed', 'open', 'removed', 'resolved', 'closed'
attr_accessor :state

# @return [String] A resource identifier for the API the issue was
# created for.
attr_accessor :api_id


#
# Mapper for IssueContractBaseProperties class as Ruby Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
required: false,
serialized_name: 'IssueContractBaseProperties',
type: {
name: 'Composite',
class_name: 'IssueContractBaseProperties',
model_properties: {
created_date: {
required: false,
serialized_name: 'createdDate',
type: {
name: 'DateTime'
}
},
state: {
required: false,
serialized_name: 'state',
type: {
name: 'String'
}
},
api_id: {
required: false,
serialized_name: 'apiId',
type: {
name: 'String'
}
}
}
}
}
end
end
end
end
Loading