diff --git a/ChangeLog.md b/ChangeLog.md index 33c3e56c21..dd69ad2f17 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,7 @@ +## 2018.01.30 - Azure ARM release version 0.15.3 +* Releasing 0.15.3 version of azure_mgmt_event_grid gem.Refer [PR #1257](https://github.com/Azure/azure-sdk-for-ruby/pull/1257) for further details. +* Releasing 0.15.3 version of azure_event_grid(data plane) gem.Refer [PR #1257](https://github.com/Azure/azure-sdk-for-ruby/pull/1257) for further details. + ## 2017.12.19 - Azure ARM release version 0.15.2 * Update azure_mgmt_compute gem to include latest api-versions supporting user assigned identity and ms_rest_azure dependency to 0.10.1 diff --git a/GEMS_TO_RELEASE b/GEMS_TO_RELEASE index 18e20ba8e0..8b113595ee 100644 --- a/GEMS_TO_RELEASE +++ b/GEMS_TO_RELEASE @@ -1,60 +1,8 @@ { - "rollup": ["azure_sdk"], + "data": [ + "azure_event_grid" + ], "management": [ - "azure_mgmt_analysis_services", - "azure_mgmt_authorization", - "azure_mgmt_automation", - "azure_mgmt_batch", - "azure_mgmt_billing", - "azure_mgmt_cdn", - "azure_mgmt_cognitive_services", - "azure_mgmt_commerce", - "azure_mgmt_compute", - "azure_mgmt_container_instance", - "azure_mgmt_container_registry", - "azure_mgmt_container_service", - "azure_mgmt_customer_insights", - "azure_mgmt_datalake_analytics", - "azure_mgmt_datalake_store", - "azure_mgmt_devtestlabs", - "azure_mgmt_dns", - "azure_mgmt_event_grid", - "azure_mgmt_event_hub", - "azure_mgmt_features", - "azure_mgmt_graph", - "azure_mgmt_iot_hub", - "azure_mgmt_key_vault", - "azure_mgmt_links", - "azure_mgmt_locks", - "azure_mgmt_logic", - "azure_mgmt_machine_learning", - "azure_mgmt_managed_applications", - "azure_mgmt_marketplace_ordering", - "azure_mgmt_media_services", - "azure_mgmt_mobile_engagement", - "azure_mgmt_monitor", - "azure_mgmt_network", - "azure_mgmt_notification_hubs", - "azure_mgmt_operational_insights", - "azure_mgmt_policy", - "azure_mgmt_powerbi_embedded", - "azure_mgmt_recovery_services", - "azure_mgmt_recovery_services_backup", - "azure_mgmt_recovery_services_site_recovery", - "azure_mgmt_redis", - "azure_mgmt_relay", - "azure_mgmt_resources", - "azure_mgmt_resources_management", - "azure_mgmt_scheduler", - "azure_mgmt_search", - "azure_mgmt_server_management", - "azure_mgmt_service_bus", - "azure_mgmt_service_fabric", - "azure_mgmt_sql", - "azure_mgmt_stor_simple8000_series", - "azure_mgmt_stream_analytics", - "azure_mgmt_subscriptions", - "azure_mgmt_traffic_manager", - "azure_mgmt_web" + "azure_mgmt_event_grid" ] } \ No newline at end of file diff --git a/GEM_VERSIONS b/GEM_VERSIONS index fe247bf5f9..bd5140484d 100644 --- a/GEM_VERSIONS +++ b/GEM_VERSIONS @@ -14,7 +14,8 @@ "azure_cognitiveservices_spellcheck": "0.15.2", "azure_cognitiveservices_textanalytics": "0.15.2", "azure_cognitiveservices_videosearch": "0.15.2", - "azure_cognitiveservices_websearch": "0.15.2" + "azure_cognitiveservices_websearch": "0.15.2", + "azure_event_grid": "0.15.3" }, "management" : { "azure_mgmt_analysis_services": "0.15.2", @@ -35,7 +36,7 @@ "azure_mgmt_datalake_store": "0.15.2", "azure_mgmt_devtestlabs": "0.15.2", "azure_mgmt_dns": "0.15.2", - "azure_mgmt_event_grid": "0.15.2", + "azure_mgmt_event_grid": "0.15.3", "azure_mgmt_event_hub": "0.15.2", "azure_mgmt_features": "0.15.2", "azure_mgmt_iot_hub": "0.15.2", diff --git a/Gemfile b/Gemfile index ccdd9d09f6..ea685d96df 100644 --- a/Gemfile +++ b/Gemfile @@ -81,4 +81,5 @@ gem 'azure_cognitiveservices_spellcheck', path: 'data/azure_cognitiveservi gem 'azure_cognitiveservices_textanalytics', path: 'data/azure_cognitiveservices_textanalytics' gem 'azure_cognitiveservices_videosearch', path: 'data/azure_cognitiveservices_videosearch' gem 'azure_cognitiveservices_websearch', path: 'data/azure_cognitiveservices_websearch' +gem 'azure_event_grid', path: 'data/azure_event_grid' gem 'azure_sdk', path: 'azure_sdk' diff --git a/azure_sdk/lib/latest/latest_profile_client.rb b/azure_sdk/lib/latest/latest_profile_client.rb index 388411a40d..502401e0e7 100644 --- a/azure_sdk/lib/latest/latest_profile_client.rb +++ b/azure_sdk/lib/latest/latest_profile_client.rb @@ -327,11 +327,10 @@ def initialize(context, base_url, options) end end - class EventGridAdapter - attr_accessor :mgmt + class EventGridAdapter < Azure::Profiles::Latest::EventGrid::EventGridDataClass def initialize(context, base_url, options) - @mgmt = Azure::Profiles::Latest::EventGrid::Mgmt::EventGridManagementClass.new(context, base_url, options) + super(context) end end diff --git a/azure_sdk/lib/latest/modules/eventgrid_profile_module.rb b/azure_sdk/lib/latest/modules/eventgrid_profile_module.rb index 180d75f833..7adf6ceed8 100644 --- a/azure_sdk/lib/latest/modules/eventgrid_profile_module.rb +++ b/azure_sdk/lib/latest/modules/eventgrid_profile_module.rb @@ -2,148 +2,74 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -require 'azure_mgmt_event_grid' +require 'azure_event_grid' module Azure::Profiles::Latest module EventGrid - module Mgmt - EventSubscriptions = Azure::EventGrid::Mgmt::V2017_09_15_preview::EventSubscriptions - Operations = Azure::EventGrid::Mgmt::V2017_09_15_preview::Operations - Topics = Azure::EventGrid::Mgmt::V2017_09_15_preview::Topics - TopicTypes = Azure::EventGrid::Mgmt::V2017_09_15_preview::TopicTypes - module Models - Operation = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Operation - OperationsListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationsListResult - EventSubscriptionFilter = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionFilter - EventSubscriptionDestination = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionDestination - OperationInfo = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationInfo - EventTypesListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventTypesListResult - TopicSharedAccessKeys = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicSharedAccessKeys - EventSubscriptionUpdateParameters = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionUpdateParameters - Resource = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Resource - EventSubscriptionsListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionsListResult - EventSubscriptionFullUrl = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionFullUrl - TopicTypesListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypesListResult - TopicRegenerateKeyRequest = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicRegenerateKeyRequest - TopicsListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicsListResult - WebHookEventSubscriptionDestination = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::WebHookEventSubscriptionDestination - EventHubEventSubscriptionDestination = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventHubEventSubscriptionDestination - EventSubscription = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscription - TrackedResource = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TrackedResource - Topic = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Topic - EventType = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventType - TopicTypeInfo = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypeInfo - EventSubscriptionProvisioningState = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionProvisioningState - OperationOrigin = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationOrigin - TopicProvisioningState = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicProvisioningState - ResourceRegionType = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::ResourceRegionType - TopicTypeProvisioningState = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypeProvisioningState - end - - class EventGridManagementClass - attr_reader :event_subscriptions, :operations, :topics, :topic_types, :configurable, :base_url, :options, :model_classes + module Models + ResourceWriteCancelData = Azure::EventGrid::V2018_01_01::Models::ResourceWriteCancelData + StorageBlobCreatedEventData = Azure::EventGrid::V2018_01_01::Models::StorageBlobCreatedEventData + ResourceDeleteSuccessData = Azure::EventGrid::V2018_01_01::Models::ResourceDeleteSuccessData + EventHubCaptureFileCreatedEventData = Azure::EventGrid::V2018_01_01::Models::EventHubCaptureFileCreatedEventData + ResourceDeleteFailureData = Azure::EventGrid::V2018_01_01::Models::ResourceDeleteFailureData + ResourceWriteFailureData = Azure::EventGrid::V2018_01_01::Models::ResourceWriteFailureData + ResourceDeleteCancelData = Azure::EventGrid::V2018_01_01::Models::ResourceDeleteCancelData + ResourceWriteSuccessData = Azure::EventGrid::V2018_01_01::Models::ResourceWriteSuccessData + EventGridEvent = Azure::EventGrid::V2018_01_01::Models::EventGridEvent + StorageBlobDeletedEventData = Azure::EventGrid::V2018_01_01::Models::StorageBlobDeletedEventData + end - def initialize(configurable, base_url=nil, options=nil) - @configurable, @base_url, @options = configurable, base_url, options + class EventGridDataClass + attr_reader :configurable, :base_url, :options, :model_classes - client_0 = Azure::EventGrid::Mgmt::V2017_09_15_preview::EventGridManagementClient.new(configurable.credentials, base_url, options) - if(client_0.respond_to?(:subscription_id)) - client_0.subscription_id = configurable.subscription_id - end - add_telemetry(client_0) - @event_subscriptions = client_0.event_subscriptions - @operations = client_0.operations - @topics = client_0.topics - @topic_types = client_0.topic_types + def initialize(configurable, base_url=nil, options=nil) + @configurable, @base_url, @options = configurable, base_url, options - @model_classes = ModelClasses.new + client_0 = Azure::EventGrid::V2018_01_01::EventGridClient.new(configurable.credentials, options) + if(client_0.respond_to?(:subscription_id)) + client_0.subscription_id = configurable.subscription_id end + add_telemetry(client_0) - def add_telemetry(client) - profile_information = 'Profiles/azure_sdk/Latest/EventGrid/Mgmt' - client.add_user_agent_information(profile_information) - end + @model_classes = ModelClasses.new + end + + def add_telemetry(client) + profile_information = 'Profiles/azure_sdk/Latest/EventGrid' + client.add_user_agent_information(profile_information) + end - class ModelClasses - def operation - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Operation - end - def operations_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationsListResult - end - def event_subscription_filter - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionFilter - end - def event_subscription_destination - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionDestination - end - def operation_info - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationInfo - end - def event_types_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventTypesListResult - end - def topic_shared_access_keys - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicSharedAccessKeys - end - def event_subscription_update_parameters - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionUpdateParameters - end - def resource - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Resource - end - def event_subscriptions_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionsListResult - end - def event_subscription_full_url - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionFullUrl - end - def topic_types_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypesListResult - end - def topic_regenerate_key_request - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicRegenerateKeyRequest - end - def topics_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicsListResult - end - def web_hook_event_subscription_destination - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::WebHookEventSubscriptionDestination - end - def event_hub_event_subscription_destination - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventHubEventSubscriptionDestination - end - def event_subscription - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscription - end - def tracked_resource - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TrackedResource - end - def topic - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Topic - end - def event_type - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventType - end - def topic_type_info - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypeInfo - end - def event_subscription_provisioning_state - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionProvisioningState - end - def operation_origin - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationOrigin - end - def topic_provisioning_state - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicProvisioningState - end - def resource_region_type - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::ResourceRegionType - end - def topic_type_provisioning_state - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypeProvisioningState - end + class ModelClasses + def resource_write_cancel_data + Azure::EventGrid::V2018_01_01::Models::ResourceWriteCancelData + end + def storage_blob_created_event_data + Azure::EventGrid::V2018_01_01::Models::StorageBlobCreatedEventData + end + def resource_delete_success_data + Azure::EventGrid::V2018_01_01::Models::ResourceDeleteSuccessData + end + def event_hub_capture_file_created_event_data + Azure::EventGrid::V2018_01_01::Models::EventHubCaptureFileCreatedEventData + end + def resource_delete_failure_data + Azure::EventGrid::V2018_01_01::Models::ResourceDeleteFailureData + end + def resource_write_failure_data + Azure::EventGrid::V2018_01_01::Models::ResourceWriteFailureData + end + def resource_delete_cancel_data + Azure::EventGrid::V2018_01_01::Models::ResourceDeleteCancelData + end + def resource_write_success_data + Azure::EventGrid::V2018_01_01::Models::ResourceWriteSuccessData + end + def event_grid_event + Azure::EventGrid::V2018_01_01::Models::EventGridEvent + end + def storage_blob_deleted_event_data + Azure::EventGrid::V2018_01_01::Models::StorageBlobDeletedEventData end end end diff --git a/config.json b/config.json index 0a68cd1ddb..db16fbe71f 100644 --- a/config.json +++ b/config.json @@ -218,13 +218,18 @@ } }, "azure_mgmt_event_grid": { + "azure_mgmt_event_grid_2018_01_01": { + "markdown": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/635c47960acb6787ebf2c4e1be6f8adc1a8d4256/specification/eventgrid/resource-manager/readme.md", + "namespace": "Azure::EventGrid::Mgmt::V2018_01_01", + "tag": "package-2018-01" + }, "azure_mgmt_event_grid_2017_09_15_preview": { - "markdown": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/7aa3a5247895ba34d6cfec73e036bb66dc907d20/specification/eventgrid/resource-manager/readme.md", + "markdown": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/635c47960acb6787ebf2c4e1be6f8adc1a8d4256/specification/eventgrid/resource-manager/readme.md", "namespace": "Azure::EventGrid::Mgmt::V2017_09_15_preview", "tag": "package-2017-09-preview" }, "azure_mgmt_event_grid_2017_06_15_preview": { - "markdown": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/7aa3a5247895ba34d6cfec73e036bb66dc907d20/specification/eventgrid/resource-manager/readme.md", + "markdown": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/635c47960acb6787ebf2c4e1be6f8adc1a8d4256/specification/eventgrid/resource-manager/readme.md", "namespace": "Azure::EventGrid::Mgmt::V2017_06_15_preview", "tag": "package-2017-06-preview" } @@ -918,5 +923,12 @@ "namespace": "Azure::CognitiveServices::WebSearch::V1_0", "title": "WebSearchClient" } + }, + "azure_event_grid":{ + "azure_event_grid_2018_01_01": { + "markdown": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/635c47960acb6787ebf2c4e1be6f8adc1a8d4256/specification/eventgrid/data-plane/readme.md", + "namespace": "Azure::EventGrid::V2018_01_01", + "tag": "package-2018-01" + } } } diff --git a/data/azure_event_grid/.rspec b/data/azure_event_grid/.rspec new file mode 100644 index 0000000000..4e33a322b5 --- /dev/null +++ b/data/azure_event_grid/.rspec @@ -0,0 +1,3 @@ +--require spec_helper +--color +--format documentation diff --git a/data/azure_event_grid/LICENSE.txt b/data/azure_event_grid/LICENSE.txt new file mode 100644 index 0000000000..d5b09a3830 --- /dev/null +++ b/data/azure_event_grid/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Microsoft Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/data/azure_event_grid/Rakefile b/data/azure_event_grid/Rakefile new file mode 100644 index 0000000000..ccbf835904 --- /dev/null +++ b/data/azure_event_grid/Rakefile @@ -0,0 +1,5 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +require "bundler/gem_tasks" diff --git a/data/azure_event_grid/azure_event_grid.gemspec b/data/azure_event_grid/azure_event_grid.gemspec new file mode 100644 index 0000000000..69de88ddb7 --- /dev/null +++ b/data/azure_event_grid/azure_event_grid.gemspec @@ -0,0 +1,42 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) + +require '../azure_event_grid/lib/module_definition' +require '../azure_event_grid/lib/version' + +Gem::Specification.new do |spec| + spec.name = 'azure_event_grid' + spec.version = Azure::EventGrid::VERSION + spec.authors = 'Microsoft Corporation' + spec.email = 'azrubyteam@microsoft.com' + spec.description = 'Microsoft Azure Event Grid Client Library for Ruby' + spec.summary = 'Official Ruby client library to consume Microsoft Azure Event Grid.' + spec.homepage = 'https://aka.ms/azure-sdk-for-ruby' + spec.license = 'MIT' + spec.metadata = { + 'bug_tracker_uri' => 'https://github.com/Azure/azure-sdk-for-ruby/issues', + 'changelog_uri' => 'https://github.com/Azure/azure-sdk-for-ruby/blob/master/ChangeLog.md', + 'documentation_uri' => 'https://azure.microsoft.com/en-us/develop/ruby/', + 'homepage_uri' => 'https://aka.ms/azure-sdk-for-ruby', + 'source_code_uri' => 'https://github.com/Azure/azure-sdk-for-ruby/tree/master/data/azure_event_grid' + } + + spec.files = Dir["LICENSE.txt", "lib/**/*"] + spec.files.reject! { |fn| fn.include? "build.json" } + spec.bindir = 'bin' + spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } + spec.require_paths = ['lib'] + + spec.required_ruby_version = '>= 2.0.0' + + spec.add_development_dependency 'bundler', '~> 1.9' + spec.add_development_dependency 'rake', '~> 10' + spec.add_development_dependency 'rspec', '~> 3' + spec.add_development_dependency 'dotenv', '~> 2' + + spec.add_runtime_dependency 'ms_rest_azure', '~> 0.10.0' +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid.rb new file mode 100644 index 0000000000..d4e3292aee --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid.rb @@ -0,0 +1,37 @@ +# 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. + +require 'uri' +require 'cgi' +require 'date' +require 'json' +require 'base64' +require 'erb' +require 'securerandom' +require 'time' +require 'timeliness' +require 'faraday' +require 'faraday-cookie_jar' +require 'concurrent' +require 'ms_rest' +require '2018-01-01/generated/azure_event_grid/module_definition' +require 'ms_rest_azure' + +module Azure::EventGrid::V2018_01_01 + autoload :EventGridClient, '2018-01-01/generated/azure_event_grid/event_grid_client.rb' + + module Models + autoload :ResourceWriteCancelData, '2018-01-01/generated/azure_event_grid/models/resource_write_cancel_data.rb' + autoload :StorageBlobCreatedEventData, '2018-01-01/generated/azure_event_grid/models/storage_blob_created_event_data.rb' + autoload :ResourceDeleteSuccessData, '2018-01-01/generated/azure_event_grid/models/resource_delete_success_data.rb' + autoload :EventHubCaptureFileCreatedEventData, '2018-01-01/generated/azure_event_grid/models/event_hub_capture_file_created_event_data.rb' + autoload :ResourceDeleteFailureData, '2018-01-01/generated/azure_event_grid/models/resource_delete_failure_data.rb' + autoload :ResourceWriteFailureData, '2018-01-01/generated/azure_event_grid/models/resource_write_failure_data.rb' + autoload :ResourceDeleteCancelData, '2018-01-01/generated/azure_event_grid/models/resource_delete_cancel_data.rb' + autoload :ResourceWriteSuccessData, '2018-01-01/generated/azure_event_grid/models/resource_write_success_data.rb' + autoload :EventGridEvent, '2018-01-01/generated/azure_event_grid/models/event_grid_event.rb' + autoload :StorageBlobDeletedEventData, '2018-01-01/generated/azure_event_grid/models/storage_blob_deleted_event_data.rb' + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/event_grid_client.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/event_grid_client.rb new file mode 100644 index 0000000000..618d1a95e8 --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/event_grid_client.rb @@ -0,0 +1,232 @@ +# 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::EventGrid::V2018_01_01 + # + # A service client - single point of access to the REST API. + # + class EventGridClient < MsRestAzure::AzureServiceClient + include MsRestAzure + include MsRestAzure::Serialization + + # @return [String] the base URI of the service. + attr_reader :base_url + + # @return Credentials needed for the client to connect to Azure. + attr_reader :credentials + + # @return [String] Version of the API to be used with the client request. + attr_reader :api_version + + # @return [String] Gets or sets the preferred language for the response. + attr_accessor :accept_language + + # @return [Integer] Gets or sets the retry timeout in seconds for Long + # Running Operations. Default value is 30. + attr_accessor :long_running_operation_retry_timeout + + # @return [Boolean] When set to true a unique x-ms-client-request-id value + # is generated and included in each request. Default is true. + attr_accessor :generate_client_request_id + + # + # Creates initializes a new instance of the EventGridClient class. + # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. + # @param options [Array] filters to be applied to the HTTP requests. + # + def initialize(credentials = nil, options = nil) + super(credentials, options) + @base_url = 'https://{topicHostname}' + + fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? + @credentials = credentials + + @api_version = '2018-01-01' + @accept_language = 'en-US' + @long_running_operation_retry_timeout = 30 + @generate_client_request_id = true + add_telemetry + end + + # + # Makes a request and returns the body of the response. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [Hash{String=>String}] containing the body of the response. + # Example: + # + # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}" + # path = "/path" + # options = { + # body: request_content, + # query_params: {'api-version' => '2016-02-01'} + # } + # result = @client.make_request(:put, path, options) + # + def make_request(method, path, options = {}) + result = make_request_with_http_info(method, path, options) + result.body unless result.nil? + end + + # + # Makes a request and returns the operation response. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status. + # + def make_request_with_http_info(method, path, options = {}) + result = make_request_async(method, path, options).value! + result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) + result + end + + # + # Makes a request asynchronously. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def make_request_async(method, path, options = {}) + fail ArgumentError, 'method is nil' if method.nil? + fail ArgumentError, 'path is nil' if path.nil? + + request_url = options[:base_url] || @base_url + if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?) + @request_headers['Content-Type'] = options[:headers]['Content-Type'] + end + + request_headers = @request_headers + request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? + options.merge!({headers: request_headers.merge(options[:headers] || {})}) + options.merge!({credentials: @credentials}) unless @credentials.nil? + + super(request_url, method, path, options) + end + + # + # Publishes a batch of events to an Azure Event Grid topic. + # + # @param topic_hostname [String] The host name of the topic, e.g. + # topic1.westus2-1.eventgrid.azure.net + # @param events [Array] An array of events to be published to + # Event Grid. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def publish_events(topic_hostname, events, custom_headers = nil) + response = publish_events_async(topic_hostname, events, custom_headers).value! + nil + end + + # + # Publishes a batch of events to an Azure Event Grid topic. + # + # @param topic_hostname [String] The host name of the topic, e.g. + # topic1.westus2-1.eventgrid.azure.net + # @param events [Array] An array of events to be published to + # Event Grid. + # @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 publish_events_with_http_info(topic_hostname, events, custom_headers = nil) + publish_events_async(topic_hostname, events, custom_headers).value! + end + + # + # Publishes a batch of events to an Azure Event Grid topic. + # + # @param topic_hostname [String] The host name of the topic, e.g. + # topic1.westus2-1.eventgrid.azure.net + # @param events [Array] An array of events to be published to + # Event Grid. + # @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 publish_events_async(topic_hostname, events, custom_headers = nil) + fail ArgumentError, 'topic_hostname is nil' if topic_hostname.nil? + fail ArgumentError, 'events is nil' if events.nil? + fail ArgumentError, 'api_version is nil' if api_version.nil? + + + request_headers = {} + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + # Serialize Request + request_mapper = { + client_side_validation: true, + required: true, + serialized_name: 'events', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'EventGridEventElementType', + type: { + name: 'Composite', + class_name: 'EventGridEvent' + } + } + } + } + request_content = self.serialize(request_mapper, events) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'api/events' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{topicHostname}', topic_hostname) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'api-version' => api_version}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.make_request_async(:post, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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 + + + private + # + # Adds telemetry information. + # + def add_telemetry + sdk_information = 'azure_event_grid' + sdk_information = "#{sdk_information}/0.15.3" + add_user_agent_information(sdk_information) + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/event_grid_event.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/event_grid_event.rb new file mode 100644 index 0000000000..87758fb08f --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/event_grid_event.rb @@ -0,0 +1,124 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Properties of an event published to an Event Grid topic. + # + class EventGridEvent + + include MsRestAzure + + # @return [String] An unique identifier for the event. + attr_accessor :id + + # @return [String] The resource path of the event source. + attr_accessor :topic + + # @return [String] A resource path relative to the topic path. + attr_accessor :subject + + # @return Event data specific to the event type. + attr_accessor :data + + # @return [String] The type of the event that occurred. + attr_accessor :event_type + + # @return [DateTime] The time (in UTC) the event was generated. + attr_accessor :event_time + + # @return [String] The schema version of the event metadata. + attr_accessor :metadata_version + + # @return [String] The schema version of the data object. + attr_accessor :data_version + + + # + # Mapper for EventGridEvent class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventGridEvent', + type: { + name: 'Composite', + class_name: 'EventGridEvent', + model_properties: { + id: { + client_side_validation: true, + required: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + topic: { + client_side_validation: true, + required: false, + serialized_name: 'topic', + type: { + name: 'String' + } + }, + subject: { + client_side_validation: true, + required: true, + serialized_name: 'subject', + type: { + name: 'String' + } + }, + data: { + client_side_validation: true, + required: true, + serialized_name: 'data', + type: { + name: 'Object' + } + }, + event_type: { + client_side_validation: true, + required: true, + serialized_name: 'eventType', + type: { + name: 'String' + } + }, + event_time: { + client_side_validation: true, + required: true, + serialized_name: 'eventTime', + type: { + name: 'DateTime' + } + }, + metadata_version: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'metadataVersion', + type: { + name: 'String' + } + }, + data_version: { + client_side_validation: true, + required: true, + serialized_name: 'dataVersion', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/event_hub_capture_file_created_event_data.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/event_hub_capture_file_created_event_data.rb new file mode 100644 index 0000000000..3e4908cdbd --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/event_hub_capture_file_created_event_data.rb @@ -0,0 +1,135 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Schema of the Data property of an EventGridEvent for an + # Microsoft.EventHub.CaptureFileCreated event. + # + class EventHubCaptureFileCreatedEventData + + include MsRestAzure + + # @return [String] The path to the capture file. + attr_accessor :fileurl + + # @return [String] The file type of the capture file. + attr_accessor :file_type + + # @return [String] The shard ID. + attr_accessor :partition_id + + # @return [Integer] The file size. + attr_accessor :size_in_bytes + + # @return [Integer] The number of events in the file. + attr_accessor :event_count + + # @return [Integer] The smallest sequence number from the queue. + attr_accessor :first_sequence_number + + # @return [Integer] The last sequence number from the queue. + attr_accessor :last_sequence_number + + # @return [DateTime] The first time from the queue. + attr_accessor :first_enqueue_time + + # @return [DateTime] The last time from the queue. + attr_accessor :last_enqueue_time + + + # + # Mapper for EventHubCaptureFileCreatedEventData class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventHubCaptureFileCreatedEventData', + type: { + name: 'Composite', + class_name: 'EventHubCaptureFileCreatedEventData', + model_properties: { + fileurl: { + client_side_validation: true, + required: false, + serialized_name: 'fileurl', + type: { + name: 'String' + } + }, + file_type: { + client_side_validation: true, + required: false, + serialized_name: 'fileType', + type: { + name: 'String' + } + }, + partition_id: { + client_side_validation: true, + required: false, + serialized_name: 'partitionId', + type: { + name: 'String' + } + }, + size_in_bytes: { + client_side_validation: true, + required: false, + serialized_name: 'sizeInBytes', + type: { + name: 'Number' + } + }, + event_count: { + client_side_validation: true, + required: false, + serialized_name: 'eventCount', + type: { + name: 'Number' + } + }, + first_sequence_number: { + client_side_validation: true, + required: false, + serialized_name: 'firstSequenceNumber', + type: { + name: 'Number' + } + }, + last_sequence_number: { + client_side_validation: true, + required: false, + serialized_name: 'lastSequenceNumber', + type: { + name: 'Number' + } + }, + first_enqueue_time: { + client_side_validation: true, + required: false, + serialized_name: 'firstEnqueueTime', + type: { + name: 'DateTime' + } + }, + last_enqueue_time: { + client_side_validation: true, + required: false, + serialized_name: 'lastEnqueueTime', + type: { + name: 'DateTime' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_delete_cancel_data.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_delete_cancel_data.rb new file mode 100644 index 0000000000..a167a7d3a4 --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_delete_cancel_data.rb @@ -0,0 +1,158 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Schema of the Data property of an EventGridEvent for an + # Microsoft.Resources.ResourceDeleteCancel event. This is raised when a + # resource delete operation is canceled. + # + class ResourceDeleteCancelData + + include MsRestAzure + + # @return [String] The tenant ID of the resource. + attr_accessor :tenant_id + + # @return [String] The subscription ID of the resource. + attr_accessor :subscription_id + + # @return [String] The resource group of the resource. + attr_accessor :resource_group + + # @return [String] The resource provider performing the operation. + attr_accessor :resource_provider + + # @return [String] The URI of the resource in the operation. + attr_accessor :resource_uri + + # @return [String] The operation that was performed. + attr_accessor :operation_name + + # @return [String] The status of the operation. + attr_accessor :status + + # @return [String] The requested authorization for the operation. + attr_accessor :authorization + + # @return [String] The properties of the claims. + attr_accessor :claims + + # @return [String] An operation ID used for troubleshooting. + attr_accessor :correlation_id + + # @return [String] The details of the operation. + attr_accessor :http_request + + + # + # Mapper for ResourceDeleteCancelData class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'ResourceDeleteCancelData', + type: { + name: 'Composite', + class_name: 'ResourceDeleteCancelData', + model_properties: { + tenant_id: { + client_side_validation: true, + required: false, + serialized_name: 'tenantId', + type: { + name: 'String' + } + }, + subscription_id: { + client_side_validation: true, + required: false, + serialized_name: 'subscriptionId', + type: { + name: 'String' + } + }, + resource_group: { + client_side_validation: true, + required: false, + serialized_name: 'resourceGroup', + type: { + name: 'String' + } + }, + resource_provider: { + client_side_validation: true, + required: false, + serialized_name: 'resourceProvider', + type: { + name: 'String' + } + }, + resource_uri: { + client_side_validation: true, + required: false, + serialized_name: 'resourceUri', + type: { + name: 'String' + } + }, + operation_name: { + client_side_validation: true, + required: false, + serialized_name: 'operationName', + type: { + name: 'String' + } + }, + status: { + client_side_validation: true, + required: false, + serialized_name: 'status', + type: { + name: 'String' + } + }, + authorization: { + client_side_validation: true, + required: false, + serialized_name: 'authorization', + type: { + name: 'String' + } + }, + claims: { + client_side_validation: true, + required: false, + serialized_name: 'claims', + type: { + name: 'String' + } + }, + correlation_id: { + client_side_validation: true, + required: false, + serialized_name: 'correlationId', + type: { + name: 'String' + } + }, + http_request: { + client_side_validation: true, + required: false, + serialized_name: 'httpRequest', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_delete_failure_data.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_delete_failure_data.rb new file mode 100644 index 0000000000..0be5dcd984 --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_delete_failure_data.rb @@ -0,0 +1,158 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Schema of the Data property of an EventGridEvent for a + # Microsoft.Resources.ResourceDeleteFailure event. This is raised when a + # resource delete operation fails. + # + class ResourceDeleteFailureData + + include MsRestAzure + + # @return [String] The tenant ID of the resource. + attr_accessor :tenant_id + + # @return [String] The subscription ID of the resource. + attr_accessor :subscription_id + + # @return [String] The resource group of the resource. + attr_accessor :resource_group + + # @return [String] The resource provider performing the operation. + attr_accessor :resource_provider + + # @return [String] The URI of the resource in the operation. + attr_accessor :resource_uri + + # @return [String] The operation that was performed. + attr_accessor :operation_name + + # @return [String] The status of the operation. + attr_accessor :status + + # @return [String] The requested authorization for the operation. + attr_accessor :authorization + + # @return [String] The properties of the claims. + attr_accessor :claims + + # @return [String] An operation ID used for troubleshooting. + attr_accessor :correlation_id + + # @return [String] The details of the operation. + attr_accessor :http_request + + + # + # Mapper for ResourceDeleteFailureData class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'ResourceDeleteFailureData', + type: { + name: 'Composite', + class_name: 'ResourceDeleteFailureData', + model_properties: { + tenant_id: { + client_side_validation: true, + required: false, + serialized_name: 'tenantId', + type: { + name: 'String' + } + }, + subscription_id: { + client_side_validation: true, + required: false, + serialized_name: 'subscriptionId', + type: { + name: 'String' + } + }, + resource_group: { + client_side_validation: true, + required: false, + serialized_name: 'resourceGroup', + type: { + name: 'String' + } + }, + resource_provider: { + client_side_validation: true, + required: false, + serialized_name: 'resourceProvider', + type: { + name: 'String' + } + }, + resource_uri: { + client_side_validation: true, + required: false, + serialized_name: 'resourceUri', + type: { + name: 'String' + } + }, + operation_name: { + client_side_validation: true, + required: false, + serialized_name: 'operationName', + type: { + name: 'String' + } + }, + status: { + client_side_validation: true, + required: false, + serialized_name: 'status', + type: { + name: 'String' + } + }, + authorization: { + client_side_validation: true, + required: false, + serialized_name: 'authorization', + type: { + name: 'String' + } + }, + claims: { + client_side_validation: true, + required: false, + serialized_name: 'claims', + type: { + name: 'String' + } + }, + correlation_id: { + client_side_validation: true, + required: false, + serialized_name: 'correlationId', + type: { + name: 'String' + } + }, + http_request: { + client_side_validation: true, + required: false, + serialized_name: 'httpRequest', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_delete_success_data.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_delete_success_data.rb new file mode 100644 index 0000000000..20d1328997 --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_delete_success_data.rb @@ -0,0 +1,158 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Schema of the Data property of an EventGridEvent for a + # Microsoft.Resources.ResourceDeleteSuccess event. This is raised when a + # resource delete operation succeeds. + # + class ResourceDeleteSuccessData + + include MsRestAzure + + # @return [String] The tenant ID of the resource. + attr_accessor :tenant_id + + # @return [String] The subscription ID of the resource. + attr_accessor :subscription_id + + # @return [String] The resource group of the resource. + attr_accessor :resource_group + + # @return [String] The resource provider performing the operation. + attr_accessor :resource_provider + + # @return [String] The URI of the resource in the operation. + attr_accessor :resource_uri + + # @return [String] The operation that was performed. + attr_accessor :operation_name + + # @return [String] The status of the operation. + attr_accessor :status + + # @return [String] The requested authorization for the operation. + attr_accessor :authorization + + # @return [String] The properties of the claims. + attr_accessor :claims + + # @return [String] An operation ID used for troubleshooting. + attr_accessor :correlation_id + + # @return [String] The details of the operation. + attr_accessor :http_request + + + # + # Mapper for ResourceDeleteSuccessData class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'ResourceDeleteSuccessData', + type: { + name: 'Composite', + class_name: 'ResourceDeleteSuccessData', + model_properties: { + tenant_id: { + client_side_validation: true, + required: false, + serialized_name: 'tenantId', + type: { + name: 'String' + } + }, + subscription_id: { + client_side_validation: true, + required: false, + serialized_name: 'subscriptionId', + type: { + name: 'String' + } + }, + resource_group: { + client_side_validation: true, + required: false, + serialized_name: 'resourceGroup', + type: { + name: 'String' + } + }, + resource_provider: { + client_side_validation: true, + required: false, + serialized_name: 'resourceProvider', + type: { + name: 'String' + } + }, + resource_uri: { + client_side_validation: true, + required: false, + serialized_name: 'resourceUri', + type: { + name: 'String' + } + }, + operation_name: { + client_side_validation: true, + required: false, + serialized_name: 'operationName', + type: { + name: 'String' + } + }, + status: { + client_side_validation: true, + required: false, + serialized_name: 'status', + type: { + name: 'String' + } + }, + authorization: { + client_side_validation: true, + required: false, + serialized_name: 'authorization', + type: { + name: 'String' + } + }, + claims: { + client_side_validation: true, + required: false, + serialized_name: 'claims', + type: { + name: 'String' + } + }, + correlation_id: { + client_side_validation: true, + required: false, + serialized_name: 'correlationId', + type: { + name: 'String' + } + }, + http_request: { + client_side_validation: true, + required: false, + serialized_name: 'httpRequest', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_write_cancel_data.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_write_cancel_data.rb new file mode 100644 index 0000000000..83fae06f51 --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_write_cancel_data.rb @@ -0,0 +1,158 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Schema of the Data property of an EventGridEvent for a + # Microsoft.Resources.ResourceWriteCancel event. This is raised when a + # resource create or update operation is canceled. + # + class ResourceWriteCancelData + + include MsRestAzure + + # @return [String] The tenant ID of the resource. + attr_accessor :tenant_id + + # @return [String] The subscription ID of the resource. + attr_accessor :subscription_id + + # @return [String] The resource group of the resource. + attr_accessor :resource_group + + # @return [String] The resource provider performing the operation. + attr_accessor :resource_provider + + # @return [String] The URI of the resource in the operation. + attr_accessor :resource_uri + + # @return [String] The operation that was performed. + attr_accessor :operation_name + + # @return [String] The status of the operation. + attr_accessor :status + + # @return [String] The requested authorization for the operation. + attr_accessor :authorization + + # @return [String] The properties of the claims. + attr_accessor :claims + + # @return [String] An operation ID used for troubleshooting. + attr_accessor :correlation_id + + # @return [String] The details of the operation. + attr_accessor :http_request + + + # + # Mapper for ResourceWriteCancelData class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'ResourceWriteCancelData', + type: { + name: 'Composite', + class_name: 'ResourceWriteCancelData', + model_properties: { + tenant_id: { + client_side_validation: true, + required: false, + serialized_name: 'tenantId', + type: { + name: 'String' + } + }, + subscription_id: { + client_side_validation: true, + required: false, + serialized_name: 'subscriptionId', + type: { + name: 'String' + } + }, + resource_group: { + client_side_validation: true, + required: false, + serialized_name: 'resourceGroup', + type: { + name: 'String' + } + }, + resource_provider: { + client_side_validation: true, + required: false, + serialized_name: 'resourceProvider', + type: { + name: 'String' + } + }, + resource_uri: { + client_side_validation: true, + required: false, + serialized_name: 'resourceUri', + type: { + name: 'String' + } + }, + operation_name: { + client_side_validation: true, + required: false, + serialized_name: 'operationName', + type: { + name: 'String' + } + }, + status: { + client_side_validation: true, + required: false, + serialized_name: 'status', + type: { + name: 'String' + } + }, + authorization: { + client_side_validation: true, + required: false, + serialized_name: 'authorization', + type: { + name: 'String' + } + }, + claims: { + client_side_validation: true, + required: false, + serialized_name: 'claims', + type: { + name: 'String' + } + }, + correlation_id: { + client_side_validation: true, + required: false, + serialized_name: 'correlationId', + type: { + name: 'String' + } + }, + http_request: { + client_side_validation: true, + required: false, + serialized_name: 'httpRequest', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_write_failure_data.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_write_failure_data.rb new file mode 100644 index 0000000000..0dfeb7f9fe --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_write_failure_data.rb @@ -0,0 +1,158 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Schema of the Data property of an EventGridEvent for a + # Microsoft.Resources.ResourceWriteFailure event. This is raised when a + # resource create or update operation fails. + # + class ResourceWriteFailureData + + include MsRestAzure + + # @return [String] The tenant ID of the resource. + attr_accessor :tenant_id + + # @return [String] The subscription ID of the resource. + attr_accessor :subscription_id + + # @return [String] The resource group of the resource. + attr_accessor :resource_group + + # @return [String] The resource provider performing the operation. + attr_accessor :resource_provider + + # @return [String] The URI of the resource in the operation. + attr_accessor :resource_uri + + # @return [String] The operation that was performed. + attr_accessor :operation_name + + # @return [String] The status of the operation. + attr_accessor :status + + # @return [String] The requested authorization for the operation. + attr_accessor :authorization + + # @return [String] The properties of the claims. + attr_accessor :claims + + # @return [String] An operation ID used for troubleshooting. + attr_accessor :correlation_id + + # @return [String] The details of the operation. + attr_accessor :http_request + + + # + # Mapper for ResourceWriteFailureData class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'ResourceWriteFailureData', + type: { + name: 'Composite', + class_name: 'ResourceWriteFailureData', + model_properties: { + tenant_id: { + client_side_validation: true, + required: false, + serialized_name: 'tenantId', + type: { + name: 'String' + } + }, + subscription_id: { + client_side_validation: true, + required: false, + serialized_name: 'subscriptionId', + type: { + name: 'String' + } + }, + resource_group: { + client_side_validation: true, + required: false, + serialized_name: 'resourceGroup', + type: { + name: 'String' + } + }, + resource_provider: { + client_side_validation: true, + required: false, + serialized_name: 'resourceProvider', + type: { + name: 'String' + } + }, + resource_uri: { + client_side_validation: true, + required: false, + serialized_name: 'resourceUri', + type: { + name: 'String' + } + }, + operation_name: { + client_side_validation: true, + required: false, + serialized_name: 'operationName', + type: { + name: 'String' + } + }, + status: { + client_side_validation: true, + required: false, + serialized_name: 'status', + type: { + name: 'String' + } + }, + authorization: { + client_side_validation: true, + required: false, + serialized_name: 'authorization', + type: { + name: 'String' + } + }, + claims: { + client_side_validation: true, + required: false, + serialized_name: 'claims', + type: { + name: 'String' + } + }, + correlation_id: { + client_side_validation: true, + required: false, + serialized_name: 'correlationId', + type: { + name: 'String' + } + }, + http_request: { + client_side_validation: true, + required: false, + serialized_name: 'httpRequest', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_write_success_data.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_write_success_data.rb new file mode 100644 index 0000000000..d9117bb232 --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/resource_write_success_data.rb @@ -0,0 +1,158 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Schema of the Data property of an EventGridEvent for a + # Microsoft.Resources.ResourceWriteSuccess event. This is raised when a + # resource create or update operation succeeds. + # + class ResourceWriteSuccessData + + include MsRestAzure + + # @return [String] The tenant ID of the resource. + attr_accessor :tenant_id + + # @return [String] The subscription ID of the resource. + attr_accessor :subscription_id + + # @return [String] The resource group of the resource. + attr_accessor :resource_group + + # @return [String] The resource provider performing the operation. + attr_accessor :resource_provider + + # @return [String] The URI of the resource in the operation. + attr_accessor :resource_uri + + # @return [String] The operation that was performed. + attr_accessor :operation_name + + # @return [String] The status of the operation. + attr_accessor :status + + # @return [String] The requested authorization for the operation. + attr_accessor :authorization + + # @return [String] The properties of the claims. + attr_accessor :claims + + # @return [String] An operation ID used for troubleshooting. + attr_accessor :correlation_id + + # @return [String] The details of the operation. + attr_accessor :http_request + + + # + # Mapper for ResourceWriteSuccessData class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'ResourceWriteSuccessData', + type: { + name: 'Composite', + class_name: 'ResourceWriteSuccessData', + model_properties: { + tenant_id: { + client_side_validation: true, + required: false, + serialized_name: 'tenantId', + type: { + name: 'String' + } + }, + subscription_id: { + client_side_validation: true, + required: false, + serialized_name: 'subscriptionId', + type: { + name: 'String' + } + }, + resource_group: { + client_side_validation: true, + required: false, + serialized_name: 'resourceGroup', + type: { + name: 'String' + } + }, + resource_provider: { + client_side_validation: true, + required: false, + serialized_name: 'resourceProvider', + type: { + name: 'String' + } + }, + resource_uri: { + client_side_validation: true, + required: false, + serialized_name: 'resourceUri', + type: { + name: 'String' + } + }, + operation_name: { + client_side_validation: true, + required: false, + serialized_name: 'operationName', + type: { + name: 'String' + } + }, + status: { + client_side_validation: true, + required: false, + serialized_name: 'status', + type: { + name: 'String' + } + }, + authorization: { + client_side_validation: true, + required: false, + serialized_name: 'authorization', + type: { + name: 'String' + } + }, + claims: { + client_side_validation: true, + required: false, + serialized_name: 'claims', + type: { + name: 'String' + } + }, + correlation_id: { + client_side_validation: true, + required: false, + serialized_name: 'correlationId', + type: { + name: 'String' + } + }, + http_request: { + client_side_validation: true, + required: false, + serialized_name: 'httpRequest', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/storage_blob_created_event_data.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/storage_blob_created_event_data.rb new file mode 100644 index 0000000000..9ccfc265d1 --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/storage_blob_created_event_data.rb @@ -0,0 +1,157 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Schema of the Data property of an EventGridEvent for an + # Microsoft.Storage.BlobCreated event. + # + class StorageBlobCreatedEventData + + include MsRestAzure + + # @return [String] The name of the API/operation that triggered this + # event. + attr_accessor :api + + # @return [String] A request id provided by the client of the storage API + # operation that triggered this event. + attr_accessor :client_request_id + + # @return [String] The request id generated by the Storage service for + # the storage API operation that triggered this event. + attr_accessor :request_id + + # @return [String] The etag of the object at the time this event was + # triggered. + attr_accessor :e_tag + + # @return [String] The content type of the blob. This is the same as what + # would be returned in the Content-Type header from the blob. + attr_accessor :content_type + + # @return [Integer] The size of the blob in bytes. This is the same as + # what would be returned in the Content-Length header from the blob. + attr_accessor :content_length + + # @return [String] The type of blob. + attr_accessor :blob_type + + # @return [String] The path to the blob. + attr_accessor :url + + # @return [String] An opaque string value representing the logical + # sequence of events for any particular blob name. Users can use standard + # string comparison to understand the relative sequence of two events on + # the same blob name. + attr_accessor :sequencer + + # @return For service use only. Diagnostic data occasionally included by + # the Azure Storage service. This property should be ignored by event + # consumers. + attr_accessor :storage_diagnostics + + + # + # Mapper for StorageBlobCreatedEventData class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'StorageBlobCreatedEventData', + type: { + name: 'Composite', + class_name: 'StorageBlobCreatedEventData', + model_properties: { + api: { + client_side_validation: true, + required: false, + serialized_name: 'api', + type: { + name: 'String' + } + }, + client_request_id: { + client_side_validation: true, + required: false, + serialized_name: 'clientRequestId', + type: { + name: 'String' + } + }, + request_id: { + client_side_validation: true, + required: false, + serialized_name: 'requestId', + type: { + name: 'String' + } + }, + e_tag: { + client_side_validation: true, + required: false, + serialized_name: 'eTag', + type: { + name: 'String' + } + }, + content_type: { + client_side_validation: true, + required: false, + serialized_name: 'contentType', + type: { + name: 'String' + } + }, + content_length: { + client_side_validation: true, + required: false, + serialized_name: 'contentLength', + type: { + name: 'Number' + } + }, + blob_type: { + client_side_validation: true, + required: false, + serialized_name: 'blobType', + type: { + name: 'String' + } + }, + url: { + client_side_validation: true, + required: false, + serialized_name: 'url', + type: { + name: 'String' + } + }, + sequencer: { + client_side_validation: true, + required: false, + serialized_name: 'sequencer', + type: { + name: 'String' + } + }, + storage_diagnostics: { + client_side_validation: true, + required: false, + serialized_name: 'storageDiagnostics', + type: { + name: 'Object' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/storage_blob_deleted_event_data.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/storage_blob_deleted_event_data.rb new file mode 100644 index 0000000000..950dbb9d29 --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/models/storage_blob_deleted_event_data.rb @@ -0,0 +1,133 @@ +# 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::EventGrid::V2018_01_01 + module Models + # + # Schema of the Data property of an EventGridEvent for an + # Microsoft.Storage.BlobDeleted event. + # + class StorageBlobDeletedEventData + + include MsRestAzure + + # @return [String] The name of the API/operation that triggered this + # event. + attr_accessor :api + + # @return [String] A request id provided by the client of the storage API + # operation that triggered this event. + attr_accessor :client_request_id + + # @return [String] The request id generated by the Storage service for + # the storage API operation that triggered this event. + attr_accessor :request_id + + # @return [String] The content type of the blob. This is the same as what + # would be returned in the Content-Type header from the blob. + attr_accessor :content_type + + # @return [String] The type of blob. + attr_accessor :blob_type + + # @return [String] The path to the blob. + attr_accessor :url + + # @return [String] An opaque string value representing the logical + # sequence of events for any particular blob name. Users can use standard + # string comparison to understand the relative sequence of two events on + # the same blob name. + attr_accessor :sequencer + + # @return For service use only. Diagnostic data occasionally included by + # the Azure Storage service. This property should be ignored by event + # consumers. + attr_accessor :storage_diagnostics + + + # + # Mapper for StorageBlobDeletedEventData class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'StorageBlobDeletedEventData', + type: { + name: 'Composite', + class_name: 'StorageBlobDeletedEventData', + model_properties: { + api: { + client_side_validation: true, + required: false, + serialized_name: 'api', + type: { + name: 'String' + } + }, + client_request_id: { + client_side_validation: true, + required: false, + serialized_name: 'clientRequestId', + type: { + name: 'String' + } + }, + request_id: { + client_side_validation: true, + required: false, + serialized_name: 'requestId', + type: { + name: 'String' + } + }, + content_type: { + client_side_validation: true, + required: false, + serialized_name: 'contentType', + type: { + name: 'String' + } + }, + blob_type: { + client_side_validation: true, + required: false, + serialized_name: 'blobType', + type: { + name: 'String' + } + }, + url: { + client_side_validation: true, + required: false, + serialized_name: 'url', + type: { + name: 'String' + } + }, + sequencer: { + client_side_validation: true, + required: false, + serialized_name: 'sequencer', + type: { + name: 'String' + } + }, + storage_diagnostics: { + client_side_validation: true, + required: false, + serialized_name: 'storageDiagnostics', + type: { + name: 'Object' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/module_definition.rb b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/module_definition.rb new file mode 100644 index 0000000000..8554751c6c --- /dev/null +++ b/data/azure_event_grid/lib/2018-01-01/generated/azure_event_grid/module_definition.rb @@ -0,0 +1,8 @@ +# 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 end +module Azure::EventGrid end +module Azure::EventGrid::V2018_01_01 end diff --git a/data/azure_event_grid/lib/azure_event_grid.rb b/data/azure_event_grid/lib/azure_event_grid.rb new file mode 100644 index 0000000000..7211aa496d --- /dev/null +++ b/data/azure_event_grid/lib/azure_event_grid.rb @@ -0,0 +1,6 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +require '2018-01-01/generated/azure_event_grid' +require 'profiles/latest/eventgrid_latest_profile_client' diff --git a/data/azure_event_grid/lib/module_definition.rb b/data/azure_event_grid/lib/module_definition.rb new file mode 100644 index 0000000000..97775147c6 --- /dev/null +++ b/data/azure_event_grid/lib/module_definition.rb @@ -0,0 +1,6 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +module Azure end +module Azure::EventGrid end diff --git a/data/azure_event_grid/lib/profiles/latest/eventgrid_latest_profile_client.rb b/data/azure_event_grid/lib/profiles/latest/eventgrid_latest_profile_client.rb new file mode 100644 index 0000000000..3df22ed0aa --- /dev/null +++ b/data/azure_event_grid/lib/profiles/latest/eventgrid_latest_profile_client.rb @@ -0,0 +1,38 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +require 'profiles/latest/eventgrid_module_definition' +require 'profiles/latest/modules/eventgrid_profile_module' + +module Azure::EventGrid::Profiles::Latest + # + # Client class for the Latest profile SDK. + # + class Client < EventGridDataClass + include MsRestAzure::Common::Configurable + + # + # Initializes a new instance of the Client class. + # @param options [Hash] hash of client options. + # options = { + # tenant_id: 'YOUR TENANT ID', + # client_id: 'YOUR CLIENT ID', + # client_secret: 'YOUR CLIENT SECRET', + # subscription_id: 'YOUR SUBSCRIPTION ID', + # credentials: credentials, + # active_directory_settings: active_directory_settings, + # base_url: 'YOUR BASE URL', + # options: options + # } + # 'credentials' are optional and if not passed in the hash, will be obtained + # from MsRest::TokenCredentials using MsRestAzure::ApplicationTokenProvider. + # + # Also, base_url, active_directory_settings & options are optional. + # + def initialize(options = {}) + super(options) + end + + end +end diff --git a/data/azure_event_grid/lib/profiles/latest/eventgrid_module_definition.rb b/data/azure_event_grid/lib/profiles/latest/eventgrid_module_definition.rb new file mode 100644 index 0000000000..63b26a3b4b --- /dev/null +++ b/data/azure_event_grid/lib/profiles/latest/eventgrid_module_definition.rb @@ -0,0 +1,8 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +module Azure end +module Azure::EventGrid end +module Azure::EventGrid::Profiles end +module Azure::EventGrid::Profiles::Latest end diff --git a/data/azure_event_grid/lib/profiles/latest/modules/eventgrid_profile_module.rb b/data/azure_event_grid/lib/profiles/latest/modules/eventgrid_profile_module.rb new file mode 100644 index 0000000000..f3440e5a59 --- /dev/null +++ b/data/azure_event_grid/lib/profiles/latest/modules/eventgrid_profile_module.rb @@ -0,0 +1,89 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +require 'azure_event_grid' + +module Azure::EventGrid::Profiles::Latest + + module Models + ResourceWriteCancelData = Azure::EventGrid::V2018_01_01::Models::ResourceWriteCancelData + StorageBlobCreatedEventData = Azure::EventGrid::V2018_01_01::Models::StorageBlobCreatedEventData + ResourceDeleteSuccessData = Azure::EventGrid::V2018_01_01::Models::ResourceDeleteSuccessData + EventHubCaptureFileCreatedEventData = Azure::EventGrid::V2018_01_01::Models::EventHubCaptureFileCreatedEventData + ResourceDeleteFailureData = Azure::EventGrid::V2018_01_01::Models::ResourceDeleteFailureData + ResourceWriteFailureData = Azure::EventGrid::V2018_01_01::Models::ResourceWriteFailureData + ResourceDeleteCancelData = Azure::EventGrid::V2018_01_01::Models::ResourceDeleteCancelData + ResourceWriteSuccessData = Azure::EventGrid::V2018_01_01::Models::ResourceWriteSuccessData + EventGridEvent = Azure::EventGrid::V2018_01_01::Models::EventGridEvent + StorageBlobDeletedEventData = Azure::EventGrid::V2018_01_01::Models::StorageBlobDeletedEventData + end + + # + # EventGridDataClass + # + class EventGridDataClass + attr_reader :configurable, :base_url, :options, :model_classes + + def initialize(options = {}) + if options.is_a?(Hash) && options.length == 0 + @options = setup_default_options + else + @options = options + end + + reset!(options) + + @configurable = self + @base_url = options[:base_url].nil? ? nil:options[:base_url] + @options = options[:options].nil? ? nil:options[:options] + + client_0 = Azure::EventGrid::V2018_01_01::EventGridClient.new(configurable.credentials, options) + if(client_0.respond_to?(:subscription_id)) + client_0.subscription_id = configurable.subscription_id + end + add_telemetry(client_0) + + @model_classes = ModelClasses.new + end + + def add_telemetry(client) + profile_information = 'Profiles/Latest/EventGrid' + client.add_user_agent_information(profile_information) + end + + end + + class ModelClasses + def resource_write_cancel_data + Azure::EventGrid::V2018_01_01::Models::ResourceWriteCancelData + end + def storage_blob_created_event_data + Azure::EventGrid::V2018_01_01::Models::StorageBlobCreatedEventData + end + def resource_delete_success_data + Azure::EventGrid::V2018_01_01::Models::ResourceDeleteSuccessData + end + def event_hub_capture_file_created_event_data + Azure::EventGrid::V2018_01_01::Models::EventHubCaptureFileCreatedEventData + end + def resource_delete_failure_data + Azure::EventGrid::V2018_01_01::Models::ResourceDeleteFailureData + end + def resource_write_failure_data + Azure::EventGrid::V2018_01_01::Models::ResourceWriteFailureData + end + def resource_delete_cancel_data + Azure::EventGrid::V2018_01_01::Models::ResourceDeleteCancelData + end + def resource_write_success_data + Azure::EventGrid::V2018_01_01::Models::ResourceWriteSuccessData + end + def event_grid_event + Azure::EventGrid::V2018_01_01::Models::EventGridEvent + end + def storage_blob_deleted_event_data + Azure::EventGrid::V2018_01_01::Models::StorageBlobDeletedEventData + end + end +end diff --git a/data/azure_event_grid/lib/version.rb b/data/azure_event_grid/lib/version.rb new file mode 100644 index 0000000000..721c47ed4e --- /dev/null +++ b/data/azure_event_grid/lib/version.rb @@ -0,0 +1,7 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +module Azure::EventGrid + VERSION = '0.15.3' +end diff --git a/data/azure_event_grid/spec/spec_helper.rb b/data/azure_event_grid/spec/spec_helper.rb new file mode 100644 index 0000000000..069c2dde5c --- /dev/null +++ b/data/azure_event_grid/spec/spec_helper.rb @@ -0,0 +1,6 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +require 'dotenv' +Dotenv.load(File.join(File.dirname(__FILE__), '../../../.env')) diff --git a/generators/profilegen/src/profile_generator.rb b/generators/profilegen/src/profile_generator.rb index dbfcc4bc47..2bac3ea787 100644 --- a/generators/profilegen/src/profile_generator.rb +++ b/generators/profilegen/src/profile_generator.rb @@ -14,7 +14,7 @@ # Class to generate the profile # class ProfileGenerator - CLIENTS_WITH_NO_BASE_URL = %w{ComputerVisionDataClass ContentModeratorDataClass FaceDataClass TextAnalyticsDataClass} + CLIENTS_WITH_NO_BASE_URL = %w{ComputerVisionDataClass ContentModeratorDataClass FaceDataClass TextAnalyticsDataClass EventGridDataClass} # # Constructor for the profile generator. diff --git a/generators/profilegen/src/resources/dir_metadata.json b/generators/profilegen/src/resources/dir_metadata.json index 095f523a73..11ff33efb7 100644 --- a/generators/profilegen/src/resources/dir_metadata.json +++ b/generators/profilegen/src/resources/dir_metadata.json @@ -130,6 +130,11 @@ "path": "management/azure_mgmt_event_grid", "namespace": "Azure::EventGrid::Mgmt", "module_require": "azure_mgmt_event_grid" + }, + "data": { + "path": "data/azure_event_grid", + "namespace": "Azure::EventGrid", + "module_require": "azure_event_grid" } }, "Microsoft.EventHub": { diff --git a/management/azure_mgmt_event_grid/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb b/management/azure_mgmt_event_grid/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb index 6b94779b16..eff491053c 100644 --- a/management/azure_mgmt_event_grid/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +++ b/management/azure_mgmt_event_grid/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb @@ -137,7 +137,7 @@ def make_request_async(method, path, options = {}) # def add_telemetry sdk_information = 'azure_mgmt_event_grid' - sdk_information = "#{sdk_information}/0.15.2" + sdk_information = "#{sdk_information}/0.15.3" add_user_agent_information(sdk_information) end end diff --git a/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid.rb b/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid.rb index e29cf5334f..6c0266f878 100644 --- a/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid.rb +++ b/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid.rb @@ -27,19 +27,20 @@ module Azure::EventGrid::Mgmt::V2017_09_15_preview autoload :EventGridManagementClient, '2017-09-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb' module Models - autoload :Operation, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/operation.rb' autoload :OperationsListResult, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/operations_list_result.rb' - autoload :EventSubscriptionFilter, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb' autoload :EventSubscriptionDestination, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_destination.rb' - autoload :OperationInfo, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/operation_info.rb' - autoload :EventTypesListResult, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_types_list_result.rb' - autoload :TopicSharedAccessKeys, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb' - autoload :EventSubscriptionUpdateParameters, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb' + autoload :Operation, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/operation.rb' autoload :Resource, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/resource.rb' - autoload :EventSubscriptionsListResult, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb' + autoload :EventSubscriptionFilter, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb' + autoload :TopicSharedAccessKeys, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb' + autoload :EventTypesListResult, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_types_list_result.rb' + autoload :TopicRegenerateKeyRequest, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb' autoload :EventSubscriptionFullUrl, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb' + autoload :OperationInfo, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/operation_info.rb' autoload :TopicTypesListResult, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_types_list_result.rb' - autoload :TopicRegenerateKeyRequest, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb' + autoload :EventSubscriptionsListResult, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb' + autoload :TopicUpdateParameters, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb' + autoload :EventSubscriptionUpdateParameters, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb' autoload :TopicsListResult, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/topics_list_result.rb' autoload :WebHookEventSubscriptionDestination, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb' autoload :EventHubEventSubscriptionDestination, '2017-09-15-preview/generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb' diff --git a/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb b/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb index 654ef54812..46c0bddbe4 100644 --- a/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb +++ b/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/event_grid_management_client.rb @@ -137,7 +137,7 @@ def make_request_async(method, path, options = {}) # def add_telemetry sdk_information = 'azure_mgmt_event_grid' - sdk_information = "#{sdk_information}/0.15.2" + sdk_information = "#{sdk_information}/0.15.3" add_user_agent_information(sdk_information) end end diff --git a/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb b/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb new file mode 100644 index 0000000000..7b97bb8b68 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb @@ -0,0 +1,54 @@ +# 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::EventGrid::Mgmt::V2017_09_15_preview + module Models + # + # Properties of the Topic update + # + class TopicUpdateParameters + + include MsRestAzure + + # @return [Hash{String => String}] Tags of the resource + attr_accessor :tags + + + # + # Mapper for TopicUpdateParameters class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'TopicUpdateParameters', + type: { + name: 'Composite', + class_name: 'TopicUpdateParameters', + model_properties: { + tags: { + client_side_validation: true, + required: false, + serialized_name: 'tags', + type: { + name: 'Dictionary', + value: { + client_side_validation: true, + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/topics.rb b/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/topics.rb index bb709f2a57..6937c05ca8 100644 --- a/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/topics.rb +++ b/management/azure_mgmt_event_grid/lib/2017-09-15-preview/generated/azure_mgmt_event_grid/topics.rb @@ -211,6 +211,56 @@ def delete_async(resource_group_name, topic_name, custom_headers = nil) promise end + # + # Update a topic + # + # Asynchronously updates a topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Topic] operation results. + # + def update(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + response = update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers).value! + response.body unless response.nil? + end + + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + # Send request + promise = begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + result_mapper = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Topic.mapper() + parsed_response = @client.deserialize(result_mapper, parsed_response) + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + # # List topics under an Azure subscription # @@ -922,5 +972,121 @@ def begin_delete_async(resource_group_name, topic_name, custom_headers = nil) promise.execute end + # + # Update a topic + # + # Asynchronously updates a topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Topic] operation results. + # + def begin_update(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + response = begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers).value! + response.body unless response.nil? + end + + # + # Update a topic + # + # Asynchronously updates a topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @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 begin_update_with_http_info(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers).value! + end + + # + # Update a topic + # + # Asynchronously updates a topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @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 begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'topic_name is nil' if topic_name.nil? + fail ArgumentError, 'topic_update_parameters is nil' if topic_update_parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + # Serialize Request + request_mapper = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicUpdateParameters.mapper() + request_content = @client.serialize(request_mapper, topic_update_parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name}, + 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 == 201 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 201 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Topic.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + end end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid.rb new file mode 100644 index 0000000000..359926f4f4 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid.rb @@ -0,0 +1,57 @@ +# 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. + +require 'uri' +require 'cgi' +require 'date' +require 'json' +require 'base64' +require 'erb' +require 'securerandom' +require 'time' +require 'timeliness' +require 'faraday' +require 'faraday-cookie_jar' +require 'concurrent' +require 'ms_rest' +require '2018-01-01/generated/azure_mgmt_event_grid/module_definition' +require 'ms_rest_azure' + +module Azure::EventGrid::Mgmt::V2018_01_01 + autoload :EventSubscriptions, '2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb' + autoload :Operations, '2018-01-01/generated/azure_mgmt_event_grid/operations.rb' + autoload :Topics, '2018-01-01/generated/azure_mgmt_event_grid/topics.rb' + autoload :TopicTypes, '2018-01-01/generated/azure_mgmt_event_grid/topic_types.rb' + autoload :EventGridManagementClient, '2018-01-01/generated/azure_mgmt_event_grid/event_grid_management_client.rb' + + module Models + autoload :OperationsListResult, '2018-01-01/generated/azure_mgmt_event_grid/models/operations_list_result.rb' + autoload :EventSubscriptionDestination, '2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_destination.rb' + autoload :Operation, '2018-01-01/generated/azure_mgmt_event_grid/models/operation.rb' + autoload :Resource, '2018-01-01/generated/azure_mgmt_event_grid/models/resource.rb' + autoload :EventSubscriptionFilter, '2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb' + autoload :TopicSharedAccessKeys, '2018-01-01/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb' + autoload :EventTypesListResult, '2018-01-01/generated/azure_mgmt_event_grid/models/event_types_list_result.rb' + autoload :TopicRegenerateKeyRequest, '2018-01-01/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb' + autoload :EventSubscriptionFullUrl, '2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb' + autoload :OperationInfo, '2018-01-01/generated/azure_mgmt_event_grid/models/operation_info.rb' + autoload :TopicTypesListResult, '2018-01-01/generated/azure_mgmt_event_grid/models/topic_types_list_result.rb' + autoload :EventSubscriptionsListResult, '2018-01-01/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb' + autoload :TopicUpdateParameters, '2018-01-01/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb' + autoload :EventSubscriptionUpdateParameters, '2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb' + autoload :TopicsListResult, '2018-01-01/generated/azure_mgmt_event_grid/models/topics_list_result.rb' + autoload :WebHookEventSubscriptionDestination, '2018-01-01/generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb' + autoload :EventHubEventSubscriptionDestination, '2018-01-01/generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb' + autoload :EventSubscription, '2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription.rb' + autoload :TrackedResource, '2018-01-01/generated/azure_mgmt_event_grid/models/tracked_resource.rb' + autoload :Topic, '2018-01-01/generated/azure_mgmt_event_grid/models/topic.rb' + autoload :EventType, '2018-01-01/generated/azure_mgmt_event_grid/models/event_type.rb' + autoload :TopicTypeInfo, '2018-01-01/generated/azure_mgmt_event_grid/models/topic_type_info.rb' + autoload :EventSubscriptionProvisioningState, '2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_provisioning_state.rb' + autoload :TopicProvisioningState, '2018-01-01/generated/azure_mgmt_event_grid/models/topic_provisioning_state.rb' + autoload :ResourceRegionType, '2018-01-01/generated/azure_mgmt_event_grid/models/resource_region_type.rb' + autoload :TopicTypeProvisioningState, '2018-01-01/generated/azure_mgmt_event_grid/models/topic_type_provisioning_state.rb' + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_grid_management_client.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_grid_management_client.rb new file mode 100644 index 0000000000..c930e3cdf0 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_grid_management_client.rb @@ -0,0 +1,144 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + # + # A service client - single point of access to the REST API. + # + class EventGridManagementClient < MsRestAzure::AzureServiceClient + include MsRestAzure + include MsRestAzure::Serialization + + # @return [String] the base URI of the service. + attr_accessor :base_url + + # @return Credentials needed for the client to connect to Azure. + attr_reader :credentials + + # @return [String] Subscription credentials that uniquely identify a + # Microsoft Azure subscription. The subscription ID forms part of the URI + # for every service call. + attr_accessor :subscription_id + + # @return [String] Version of the API to be used with the client request. + attr_reader :api_version + + # @return [String] Gets or sets the preferred language for the response. + attr_accessor :accept_language + + # @return [Integer] Gets or sets the retry timeout in seconds for Long + # Running Operations. Default value is 30. + attr_accessor :long_running_operation_retry_timeout + + # @return [Boolean] When set to true a unique x-ms-client-request-id value + # is generated and included in each request. Default is true. + attr_accessor :generate_client_request_id + + # @return [EventSubscriptions] event_subscriptions + attr_reader :event_subscriptions + + # @return [Operations] operations + attr_reader :operations + + # @return [Topics] topics + attr_reader :topics + + # @return [TopicTypes] topic_types + attr_reader :topic_types + + # + # Creates initializes a new instance of the EventGridManagementClient class. + # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. + # @param base_url [String] the base URI of the service. + # @param options [Array] filters to be applied to the HTTP requests. + # + def initialize(credentials = nil, base_url = nil, options = nil) + super(credentials, options) + @base_url = base_url || 'https://management.azure.com' + + fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? + @credentials = credentials + + @event_subscriptions = EventSubscriptions.new(self) + @operations = Operations.new(self) + @topics = Topics.new(self) + @topic_types = TopicTypes.new(self) + @api_version = '2018-01-01' + @accept_language = 'en-US' + @long_running_operation_retry_timeout = 30 + @generate_client_request_id = true + add_telemetry + end + + # + # Makes a request and returns the body of the response. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [Hash{String=>String}] containing the body of the response. + # Example: + # + # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}" + # path = "/path" + # options = { + # body: request_content, + # query_params: {'api-version' => '2016-02-01'} + # } + # result = @client.make_request(:put, path, options) + # + def make_request(method, path, options = {}) + result = make_request_with_http_info(method, path, options) + result.body unless result.nil? + end + + # + # Makes a request and returns the operation response. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status. + # + def make_request_with_http_info(method, path, options = {}) + result = make_request_async(method, path, options).value! + result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) + result + end + + # + # Makes a request asynchronously. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def make_request_async(method, path, options = {}) + fail ArgumentError, 'method is nil' if method.nil? + fail ArgumentError, 'path is nil' if path.nil? + + request_url = options[:base_url] || @base_url + if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?) + @request_headers['Content-Type'] = options[:headers]['Content-Type'] + end + + request_headers = @request_headers + request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? + options.merge!({headers: request_headers.merge(options[:headers] || {})}) + options.merge!({credentials: @credentials}) unless @credentials.nil? + + super(request_url, method, path, options) + end + + + private + # + # Adds telemetry information. + # + def add_telemetry + sdk_information = 'azure_mgmt_event_grid' + sdk_information = "#{sdk_information}/0.15.3" + add_user_agent_information(sdk_information) + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb new file mode 100644 index 0000000000..6db8e145a0 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb @@ -0,0 +1,1799 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + # + # Azure EventGrid Management Client + # + class EventSubscriptions + include MsRestAzure + + # + # Creates and initializes a new instance of the EventSubscriptions class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [EventGridManagementClient] reference to the EventGridManagementClient + attr_reader :client + + # + # Get an event subscription + # + # Get properties of an event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscription] operation results. + # + def get(scope, event_subscription_name, custom_headers = nil) + response = get_async(scope, event_subscription_name, custom_headers).value! + response.body unless response.nil? + end + + # + # Get an event subscription + # + # Get properties of an event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @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 get_with_http_info(scope, event_subscription_name, custom_headers = nil) + get_async(scope, event_subscription_name, custom_headers).value! + end + + # + # Get an event subscription + # + # Get properties of an event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @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 get_async(scope, event_subscription_name, custom_headers = nil) + fail ArgumentError, 'scope is nil' if scope.nil? + fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'eventSubscriptionName' => event_subscription_name}, + skip_encoding_path_params: {'scope' => scope}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscription.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Create or update an event subscription + # + # Asynchronously creates a new event subscription or updates an existing event + # subscription based on the specified scope. + # + # @param scope [String] The identifier of the resource to which the event + # subscription needs to be created or updated. The scope can be a subscription, + # or a resource group, or a top level resource belonging to a resource provider + # namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription. Event + # subscription names must be between 3 and 64 characters in length and should + # use alphanumeric letters only. + # @param event_subscription_info [EventSubscription] Event subscription + # properties containing the destination and filter information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscription] operation results. + # + def create_or_update(scope, event_subscription_name, event_subscription_info, custom_headers = nil) + response = create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers).value! + response.body unless response.nil? + end + + # + # @param scope [String] The identifier of the resource to which the event + # subscription needs to be created or updated. The scope can be a subscription, + # or a resource group, or a top level resource belonging to a resource provider + # namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription. Event + # subscription names must be between 3 and 64 characters in length and should + # use alphanumeric letters only. + # @param event_subscription_info [EventSubscription] Event subscription + # properties containing the destination and filter information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers = nil) + # Send request + promise = begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscription.mapper() + parsed_response = @client.deserialize(result_mapper, parsed_response) + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Delete an event subscription + # + # Delete an existing event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + def delete(scope, event_subscription_name, custom_headers = nil) + response = delete_async(scope, event_subscription_name, custom_headers).value! + nil + end + + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def delete_async(scope, event_subscription_name, custom_headers = nil) + # Send request + promise = begin_delete_async(scope, event_subscription_name, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Update an event subscription + # + # Asynchronously updates an existing event subscription. + # + # @param scope [String] The scope of existing event subscription. The scope can + # be a subscription, or a resource group, or a top level resource belonging to + # a resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription to be + # created + # @param event_subscription_update_parameters + # [EventSubscriptionUpdateParameters] Updated event subscription information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscription] operation results. + # + def update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil) + response = update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers).value! + response.body unless response.nil? + end + + # + # @param scope [String] The scope of existing event subscription. The scope can + # be a subscription, or a resource group, or a top level resource belonging to + # a resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription to be + # created + # @param event_subscription_update_parameters + # [EventSubscriptionUpdateParameters] Updated event subscription information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil) + # Send request + promise = begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscription.mapper() + parsed_response = @client.deserialize(result_mapper, parsed_response) + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Get full URL of an event subscription + # + # Get the full endpoint URL for an event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionFullUrl] operation results. + # + def get_full_url(scope, event_subscription_name, custom_headers = nil) + response = get_full_url_async(scope, event_subscription_name, custom_headers).value! + response.body unless response.nil? + end + + # + # Get full URL of an event subscription + # + # Get the full endpoint URL for an event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @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 get_full_url_with_http_info(scope, event_subscription_name, custom_headers = nil) + get_full_url_async(scope, event_subscription_name, custom_headers).value! + end + + # + # Get full URL of an event subscription + # + # Get the full endpoint URL for an event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @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 get_full_url_async(scope, event_subscription_name, custom_headers = nil) + fail ArgumentError, 'scope is nil' if scope.nil? + fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'eventSubscriptionName' => event_subscription_name}, + skip_encoding_path_params: {'scope' => scope}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:post, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionFullUrl.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Get an aggregated list of all global event subscriptions under an Azure + # subscription + # + # List all aggregated global event subscriptions under a specific Azure + # subscription + # + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionsListResult] operation results. + # + def list_global_by_subscription(custom_headers = nil) + response = list_global_by_subscription_async(custom_headers).value! + response.body unless response.nil? + end + + # + # Get an aggregated list of all global event subscriptions under an Azure + # subscription + # + # List all aggregated global event subscriptions under a specific Azure + # subscription + # + # @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 list_global_by_subscription_with_http_info(custom_headers = nil) + list_global_by_subscription_async(custom_headers).value! + end + + # + # Get an aggregated list of all global event subscriptions under an Azure + # subscription + # + # List all aggregated global event subscriptions under a specific Azure + # subscription + # + # @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 list_global_by_subscription_async(custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List all global event subscriptions for a topic type + # + # List all global event subscriptions under an Azure subscription for a topic + # type. + # + # @param topic_type_name [String] Name of the topic type + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionsListResult] operation results. + # + def list_global_by_subscription_for_topic_type(topic_type_name, custom_headers = nil) + response = list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List all global event subscriptions for a topic type + # + # List all global event subscriptions under an Azure subscription for a topic + # type. + # + # @param topic_type_name [String] Name of the topic type + # @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 list_global_by_subscription_for_topic_type_with_http_info(topic_type_name, custom_headers = nil) + list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers).value! + end + + # + # List all global event subscriptions for a topic type + # + # List all global event subscriptions under an Azure subscription for a topic + # type. + # + # @param topic_type_name [String] Name of the topic type + # @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 list_global_by_subscription_for_topic_type_async(topic_type_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'topicTypeName' => topic_type_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List all global event subscriptions under an Azure subscription and resource + # group + # + # List all global event subscriptions under a specific Azure subscription and + # resource group + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionsListResult] operation results. + # + def list_global_by_resource_group(resource_group_name, custom_headers = nil) + response = list_global_by_resource_group_async(resource_group_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List all global event subscriptions under an Azure subscription and resource + # group + # + # List all global event subscriptions under a specific Azure subscription and + # resource group + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @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 list_global_by_resource_group_with_http_info(resource_group_name, custom_headers = nil) + list_global_by_resource_group_async(resource_group_name, custom_headers).value! + end + + # + # List all global event subscriptions under an Azure subscription and resource + # group + # + # List all global event subscriptions under a specific Azure subscription and + # resource group + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @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 list_global_by_resource_group_async(resource_group_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List all global event subscriptions under a resource group for a topic type + # + # List all global event subscriptions under a resource group for a specific + # topic type. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_type_name [String] Name of the topic type + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionsListResult] operation results. + # + def list_global_by_resource_group_for_topic_type(resource_group_name, topic_type_name, custom_headers = nil) + response = list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List all global event subscriptions under a resource group for a topic type + # + # List all global event subscriptions under a resource group for a specific + # topic type. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_type_name [String] Name of the topic type + # @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 list_global_by_resource_group_for_topic_type_with_http_info(resource_group_name, topic_type_name, custom_headers = nil) + list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers).value! + end + + # + # List all global event subscriptions under a resource group for a topic type + # + # List all global event subscriptions under a resource group for a specific + # topic type. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_type_name [String] Name of the topic type + # @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 list_global_by_resource_group_for_topic_type_async(resource_group_name, topic_type_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicTypeName' => topic_type_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List all regional event subscriptions under an Azure subscription + # + # List all event subscriptions from the given location under a specific Azure + # subscription + # + # @param location [String] Name of the location + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionsListResult] operation results. + # + def list_regional_by_subscription(location, custom_headers = nil) + response = list_regional_by_subscription_async(location, custom_headers).value! + response.body unless response.nil? + end + + # + # List all regional event subscriptions under an Azure subscription + # + # List all event subscriptions from the given location under a specific Azure + # subscription + # + # @param location [String] Name of the location + # @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 list_regional_by_subscription_with_http_info(location, custom_headers = nil) + list_regional_by_subscription_async(location, custom_headers).value! + end + + # + # List all regional event subscriptions under an Azure subscription + # + # List all event subscriptions from the given location under a specific Azure + # subscription + # + # @param location [String] Name of the location + # @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 list_regional_by_subscription_async(location, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'location is nil' if location.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'location' => location}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List all regional event subscriptions under an Azure subscription and + # resource group + # + # List all event subscriptions from the given location under a specific Azure + # subscription and resource group + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param location [String] Name of the location + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionsListResult] operation results. + # + def list_regional_by_resource_group(resource_group_name, location, custom_headers = nil) + response = list_regional_by_resource_group_async(resource_group_name, location, custom_headers).value! + response.body unless response.nil? + end + + # + # List all regional event subscriptions under an Azure subscription and + # resource group + # + # List all event subscriptions from the given location under a specific Azure + # subscription and resource group + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param location [String] Name of the location + # @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 list_regional_by_resource_group_with_http_info(resource_group_name, location, custom_headers = nil) + list_regional_by_resource_group_async(resource_group_name, location, custom_headers).value! + end + + # + # List all regional event subscriptions under an Azure subscription and + # resource group + # + # List all event subscriptions from the given location under a specific Azure + # subscription and resource group + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param location [String] Name of the location + # @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 list_regional_by_resource_group_async(resource_group_name, location, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'location is nil' if location.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'location' => location}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List all regional event subscriptions under an Azure subscription for a topic + # type + # + # List all event subscriptions from the given location under a specific Azure + # subscription and topic type. + # + # @param location [String] Name of the location + # @param topic_type_name [String] Name of the topic type + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionsListResult] operation results. + # + def list_regional_by_subscription_for_topic_type(location, topic_type_name, custom_headers = nil) + response = list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List all regional event subscriptions under an Azure subscription for a topic + # type + # + # List all event subscriptions from the given location under a specific Azure + # subscription and topic type. + # + # @param location [String] Name of the location + # @param topic_type_name [String] Name of the topic type + # @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 list_regional_by_subscription_for_topic_type_with_http_info(location, topic_type_name, custom_headers = nil) + list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers).value! + end + + # + # List all regional event subscriptions under an Azure subscription for a topic + # type + # + # List all event subscriptions from the given location under a specific Azure + # subscription and topic type. + # + # @param location [String] Name of the location + # @param topic_type_name [String] Name of the topic type + # @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 list_regional_by_subscription_for_topic_type_async(location, topic_type_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'location is nil' if location.nil? + fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'location' => location,'topicTypeName' => topic_type_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List all regional event subscriptions under an Azure subscription and + # resource group for a topic type + # + # List all event subscriptions from the given location under a specific Azure + # subscription and resource group and topic type + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param location [String] Name of the location + # @param topic_type_name [String] Name of the topic type + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionsListResult] operation results. + # + def list_regional_by_resource_group_for_topic_type(resource_group_name, location, topic_type_name, custom_headers = nil) + response = list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List all regional event subscriptions under an Azure subscription and + # resource group for a topic type + # + # List all event subscriptions from the given location under a specific Azure + # subscription and resource group and topic type + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param location [String] Name of the location + # @param topic_type_name [String] Name of the topic type + # @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 list_regional_by_resource_group_for_topic_type_with_http_info(resource_group_name, location, topic_type_name, custom_headers = nil) + list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers).value! + end + + # + # List all regional event subscriptions under an Azure subscription and + # resource group for a topic type + # + # List all event subscriptions from the given location under a specific Azure + # subscription and resource group and topic type + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param location [String] Name of the location + # @param topic_type_name [String] Name of the topic type + # @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 list_regional_by_resource_group_for_topic_type_async(resource_group_name, location, topic_type_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'location is nil' if location.nil? + fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'location' => location,'topicTypeName' => topic_type_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List all event subscriptions for a specific topic + # + # List all event subscriptions that have been created for a specific topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param provider_namespace [String] Namespace of the provider of the topic + # @param resource_type_name [String] Name of the resource type + # @param resource_name [String] Name of the resource + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscriptionsListResult] operation results. + # + def list_by_resource(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil) + response = list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List all event subscriptions for a specific topic + # + # List all event subscriptions that have been created for a specific topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param provider_namespace [String] Namespace of the provider of the topic + # @param resource_type_name [String] Name of the resource type + # @param resource_name [String] Name of the resource + # @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 list_by_resource_with_http_info(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil) + list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value! + end + + # + # List all event subscriptions for a specific topic + # + # List all event subscriptions that have been created for a specific topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param provider_namespace [String] Namespace of the provider of the topic + # @param resource_type_name [String] Name of the resource type + # @param resource_name [String] Name of the resource + # @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 list_by_resource_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'provider_namespace is nil' if provider_namespace.nil? + fail ArgumentError, 'resource_type_name is nil' if resource_type_name.nil? + fail ArgumentError, 'resource_name is nil' if resource_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerNamespace' => provider_namespace,'resourceTypeName' => resource_type_name,'resourceName' => resource_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Create or update an event subscription + # + # Asynchronously creates a new event subscription or updates an existing event + # subscription based on the specified scope. + # + # @param scope [String] The identifier of the resource to which the event + # subscription needs to be created or updated. The scope can be a subscription, + # or a resource group, or a top level resource belonging to a resource provider + # namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription. Event + # subscription names must be between 3 and 64 characters in length and should + # use alphanumeric letters only. + # @param event_subscription_info [EventSubscription] Event subscription + # properties containing the destination and filter information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscription] operation results. + # + def begin_create_or_update(scope, event_subscription_name, event_subscription_info, custom_headers = nil) + response = begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers).value! + response.body unless response.nil? + end + + # + # Create or update an event subscription + # + # Asynchronously creates a new event subscription or updates an existing event + # subscription based on the specified scope. + # + # @param scope [String] The identifier of the resource to which the event + # subscription needs to be created or updated. The scope can be a subscription, + # or a resource group, or a top level resource belonging to a resource provider + # namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription. Event + # subscription names must be between 3 and 64 characters in length and should + # use alphanumeric letters only. + # @param event_subscription_info [EventSubscription] Event subscription + # properties containing the destination and filter information + # @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 begin_create_or_update_with_http_info(scope, event_subscription_name, event_subscription_info, custom_headers = nil) + begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers).value! + end + + # + # Create or update an event subscription + # + # Asynchronously creates a new event subscription or updates an existing event + # subscription based on the specified scope. + # + # @param scope [String] The identifier of the resource to which the event + # subscription needs to be created or updated. The scope can be a subscription, + # or a resource group, or a top level resource belonging to a resource provider + # namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription. Event + # subscription names must be between 3 and 64 characters in length and should + # use alphanumeric letters only. + # @param event_subscription_info [EventSubscription] Event subscription + # properties containing the destination and filter information + # @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 begin_create_or_update_async(scope, event_subscription_name, event_subscription_info, custom_headers = nil) + fail ArgumentError, 'scope is nil' if scope.nil? + fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil? + fail ArgumentError, 'event_subscription_info is nil' if event_subscription_info.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + # Serialize Request + request_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscription.mapper() + request_content = @client.serialize(request_mapper, event_subscription_info) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'eventSubscriptionName' => event_subscription_name}, + skip_encoding_path_params: {'scope' => scope}, + 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(:put, 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 == 201 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 201 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscription.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Delete an event subscription + # + # Delete an existing event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def begin_delete(scope, event_subscription_name, custom_headers = nil) + response = begin_delete_async(scope, event_subscription_name, custom_headers).value! + nil + end + + # + # Delete an event subscription + # + # Delete an existing event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @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 begin_delete_with_http_info(scope, event_subscription_name, custom_headers = nil) + begin_delete_async(scope, event_subscription_name, custom_headers).value! + end + + # + # Delete an event subscription + # + # Delete an existing event subscription + # + # @param scope [String] The scope of the event subscription. The scope can be a + # subscription, or a resource group, or a top level resource belonging to a + # resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription + # @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 begin_delete_async(scope, event_subscription_name, custom_headers = nil) + fail ArgumentError, 'scope is nil' if scope.nil? + fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'eventSubscriptionName' => event_subscription_name}, + skip_encoding_path_params: {'scope' => scope}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:delete, 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 == 200 || status_code == 202 || status_code == 204 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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 + + # + # Update an event subscription + # + # Asynchronously updates an existing event subscription. + # + # @param scope [String] The scope of existing event subscription. The scope can + # be a subscription, or a resource group, or a top level resource belonging to + # a resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription to be + # created + # @param event_subscription_update_parameters + # [EventSubscriptionUpdateParameters] Updated event subscription information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventSubscription] operation results. + # + def begin_update(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil) + response = begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers).value! + response.body unless response.nil? + end + + # + # Update an event subscription + # + # Asynchronously updates an existing event subscription. + # + # @param scope [String] The scope of existing event subscription. The scope can + # be a subscription, or a resource group, or a top level resource belonging to + # a resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription to be + # created + # @param event_subscription_update_parameters + # [EventSubscriptionUpdateParameters] Updated event subscription information + # @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 begin_update_with_http_info(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil) + begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers).value! + end + + # + # Update an event subscription + # + # Asynchronously updates an existing event subscription. + # + # @param scope [String] The scope of existing event subscription. The scope can + # be a subscription, or a resource group, or a top level resource belonging to + # a resource provider namespace, or an EventGrid topic. For example, use + # '/subscriptions/{subscriptionId}/' for a subscription, + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a + # resource group, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' + # for a resource, and + # '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + # for an EventGrid topic. + # @param event_subscription_name [String] Name of the event subscription to be + # created + # @param event_subscription_update_parameters + # [EventSubscriptionUpdateParameters] Updated event subscription information + # @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 begin_update_async(scope, event_subscription_name, event_subscription_update_parameters, custom_headers = nil) + fail ArgumentError, 'scope is nil' if scope.nil? + fail ArgumentError, 'event_subscription_name is nil' if event_subscription_name.nil? + fail ArgumentError, 'event_subscription_update_parameters is nil' if event_subscription_update_parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + # Serialize Request + request_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionUpdateParameters.mapper() + request_content = @client.serialize(request_mapper, event_subscription_update_parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = '{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'eventSubscriptionName' => event_subscription_name}, + skip_encoding_path_params: {'scope' => scope}, + 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 == 201 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 201 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscription.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb new file mode 100644 index 0000000000..d09a53a2ee --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_hub_event_subscription_destination.rb @@ -0,0 +1,62 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Information about the event hub destination for an event subscription + # + class EventHubEventSubscriptionDestination < EventSubscriptionDestination + + include MsRestAzure + + + def initialize + @endpointType = "EventHub" + end + + attr_accessor :endpointType + + # @return [String] The Azure Resource Id that represents the endpoint of + # an Event Hub destination of an event subscription. + attr_accessor :resource_id + + + # + # Mapper for EventHubEventSubscriptionDestination class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventHub', + type: { + name: 'Composite', + class_name: 'EventHubEventSubscriptionDestination', + model_properties: { + endpointType: { + client_side_validation: true, + required: true, + serialized_name: 'endpointType', + type: { + name: 'String' + } + }, + resource_id: { + client_side_validation: true, + required: false, + serialized_name: 'properties.resourceId', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription.rb new file mode 100644 index 0000000000..aec7420c9b --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription.rb @@ -0,0 +1,136 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Event Subscription + # + class EventSubscription < Resource + + include MsRestAzure + + # @return [String] Name of the topic of the event subscription. + attr_accessor :topic + + # @return [EventSubscriptionProvisioningState] Provisioning state of the + # event subscription. Possible values include: 'Creating', 'Updating', + # 'Deleting', 'Succeeded', 'Canceled', 'Failed' + attr_accessor :provisioning_state + + # @return [EventSubscriptionDestination] Information about the + # destination where events have to be delivered for the event + # subscription. + attr_accessor :destination + + # @return [EventSubscriptionFilter] Information about the filter for the + # event subscription. + attr_accessor :filter + + # @return [Array] List of user defined labels. + attr_accessor :labels + + + # + # Mapper for EventSubscription class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventSubscription', + type: { + name: 'Composite', + class_name: 'EventSubscription', + model_properties: { + id: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + topic: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'properties.topic', + type: { + name: 'String' + } + }, + provisioning_state: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'properties.provisioningState', + type: { + name: 'String' + } + }, + destination: { + client_side_validation: true, + required: false, + serialized_name: 'properties.destination', + type: { + name: 'Composite', + polymorphic_discriminator: 'endpointType', + uber_parent: 'EventSubscriptionDestination', + class_name: 'EventSubscriptionDestination' + } + }, + filter: { + client_side_validation: true, + required: false, + serialized_name: 'properties.filter', + type: { + name: 'Composite', + class_name: 'EventSubscriptionFilter' + } + }, + labels: { + client_side_validation: true, + required: false, + serialized_name: 'properties.labels', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_destination.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_destination.rb new file mode 100644 index 0000000000..6d7f34cf96 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_destination.rb @@ -0,0 +1,47 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Information about the destination for an event subscription + # + class EventSubscriptionDestination + + include MsRestAzure + + @@discriminatorMap = Hash.new + @@discriminatorMap["WebHook"] = "WebHookEventSubscriptionDestination" + @@discriminatorMap["EventHub"] = "EventHubEventSubscriptionDestination" + + def initialize + @endpointType = "EventSubscriptionDestination" + end + + attr_accessor :endpointType + + + # + # Mapper for EventSubscriptionDestination class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventSubscriptionDestination', + type: { + name: 'Composite', + polymorphic_discriminator: 'endpointType', + uber_parent: 'EventSubscriptionDestination', + class_name: 'EventSubscriptionDestination', + model_properties: { + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb new file mode 100644 index 0000000000..b37bf135d2 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_filter.rb @@ -0,0 +1,98 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Filter for the Event Subscription + # + class EventSubscriptionFilter + + include MsRestAzure + + # @return [String] An optional string to filter events for an event + # subscription based on a resource path prefix. + # The format of this depends on the publisher of the events. + # Wildcard characters are not supported in this path. + attr_accessor :subject_begins_with + + # @return [String] An optional string to filter events for an event + # subscription based on a resource path suffix. + # Wildcard characters are not supported in this path. + attr_accessor :subject_ends_with + + # @return [Array] A list of applicable event types that need to + # be part of the event subscription. + # If it is desired to subscribe to all event types, the string "all" + # needs to be specified as an element in this list. + attr_accessor :included_event_types + + # @return [Boolean] Specifies if the SubjectBeginsWith and + # SubjectEndsWith properties of the filter + # should be compared in a case sensitive manner. Default value: false . + attr_accessor :is_subject_case_sensitive + + + # + # Mapper for EventSubscriptionFilter class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventSubscriptionFilter', + type: { + name: 'Composite', + class_name: 'EventSubscriptionFilter', + model_properties: { + subject_begins_with: { + client_side_validation: true, + required: false, + serialized_name: 'subjectBeginsWith', + type: { + name: 'String' + } + }, + subject_ends_with: { + client_side_validation: true, + required: false, + serialized_name: 'subjectEndsWith', + type: { + name: 'String' + } + }, + included_event_types: { + client_side_validation: true, + required: false, + serialized_name: 'includedEventTypes', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + is_subject_case_sensitive: { + client_side_validation: true, + required: false, + serialized_name: 'isSubjectCaseSensitive', + default_value: false, + type: { + name: 'Boolean' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb new file mode 100644 index 0000000000..221416703c --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_full_url.rb @@ -0,0 +1,47 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Full endpoint url of an event subscription + # + class EventSubscriptionFullUrl + + include MsRestAzure + + # @return [String] The URL that represents the endpoint of the + # destination of an event subscription. + attr_accessor :endpoint_url + + + # + # Mapper for EventSubscriptionFullUrl class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventSubscriptionFullUrl', + type: { + name: 'Composite', + class_name: 'EventSubscriptionFullUrl', + model_properties: { + endpoint_url: { + client_side_validation: true, + required: false, + serialized_name: 'endpointUrl', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_provisioning_state.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_provisioning_state.rb new file mode 100644 index 0000000000..d3ace7c4d7 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_provisioning_state.rb @@ -0,0 +1,20 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Defines values for EventSubscriptionProvisioningState + # + module EventSubscriptionProvisioningState + Creating = "Creating" + Updating = "Updating" + Deleting = "Deleting" + Succeeded = "Succeeded" + Canceled = "Canceled" + Failed = "Failed" + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb new file mode 100644 index 0000000000..a3f1900f06 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscription_update_parameters.rb @@ -0,0 +1,83 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Properties of the Event Subscription update + # + class EventSubscriptionUpdateParameters + + include MsRestAzure + + # @return [EventSubscriptionDestination] Information about the + # destination where events have to be delivered for the event + # subscription. + attr_accessor :destination + + # @return [EventSubscriptionFilter] Information about the filter for the + # event subscription. + attr_accessor :filter + + # @return [Array] List of user defined labels. + attr_accessor :labels + + + # + # Mapper for EventSubscriptionUpdateParameters class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventSubscriptionUpdateParameters', + type: { + name: 'Composite', + class_name: 'EventSubscriptionUpdateParameters', + model_properties: { + destination: { + client_side_validation: true, + required: false, + serialized_name: 'destination', + type: { + name: 'Composite', + polymorphic_discriminator: 'endpointType', + uber_parent: 'EventSubscriptionDestination', + class_name: 'EventSubscriptionDestination' + } + }, + filter: { + client_side_validation: true, + required: false, + serialized_name: 'filter', + type: { + name: 'Composite', + class_name: 'EventSubscriptionFilter' + } + }, + labels: { + client_side_validation: true, + required: false, + serialized_name: 'labels', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb new file mode 100644 index 0000000000..193d1b37e1 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_subscriptions_list_result.rb @@ -0,0 +1,55 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Result of the List EventSubscriptions operation + # + class EventSubscriptionsListResult + + include MsRestAzure + + # @return [Array] A collection of EventSubscriptions + attr_accessor :value + + + # + # Mapper for EventSubscriptionsListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventSubscriptionsListResult', + type: { + name: 'Composite', + class_name: 'EventSubscriptionsListResult', + model_properties: { + value: { + client_side_validation: true, + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'EventSubscriptionElementType', + type: { + name: 'Composite', + class_name: 'EventSubscription' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_type.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_type.rb new file mode 100644 index 0000000000..dae77ac3a9 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_type.rb @@ -0,0 +1,95 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Event Type for a subject under a topic + # + class EventType < Resource + + include MsRestAzure + + # @return [String] Display name of the event type. + attr_accessor :display_name + + # @return [String] Description of the event type. + attr_accessor :description + + # @return [String] Url of the schema for this event type. + attr_accessor :schema_url + + + # + # Mapper for EventType class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventType', + type: { + name: 'Composite', + class_name: 'EventType', + model_properties: { + id: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + display_name: { + client_side_validation: true, + required: false, + serialized_name: 'properties.displayName', + type: { + name: 'String' + } + }, + description: { + client_side_validation: true, + required: false, + serialized_name: 'properties.description', + type: { + name: 'String' + } + }, + schema_url: { + client_side_validation: true, + required: false, + serialized_name: 'properties.schemaUrl', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_types_list_result.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_types_list_result.rb new file mode 100644 index 0000000000..8b02816794 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/event_types_list_result.rb @@ -0,0 +1,55 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Result of the List Event Types operation + # + class EventTypesListResult + + include MsRestAzure + + # @return [Array] A collection of event types + attr_accessor :value + + + # + # Mapper for EventTypesListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'EventTypesListResult', + type: { + name: 'Composite', + class_name: 'EventTypesListResult', + model_properties: { + value: { + client_side_validation: true, + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'EventTypeElementType', + type: { + name: 'Composite', + class_name: 'EventType' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/operation.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/operation.rb new file mode 100644 index 0000000000..bc24bd3431 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/operation.rb @@ -0,0 +1,80 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Represents an operation returned by the GetOperations request + # + class Operation + + include MsRestAzure + + # @return [String] Name of the operation + attr_accessor :name + + # @return [OperationInfo] Display name of the operation + attr_accessor :display + + # @return [String] Origin of the operation + attr_accessor :origin + + # @return Properties of the operation + attr_accessor :properties + + + # + # Mapper for Operation class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'Operation', + type: { + name: 'Composite', + class_name: 'Operation', + model_properties: { + name: { + client_side_validation: true, + required: false, + serialized_name: 'name', + type: { + name: 'String' + } + }, + display: { + client_side_validation: true, + required: false, + serialized_name: 'display', + type: { + name: 'Composite', + class_name: 'OperationInfo' + } + }, + origin: { + client_side_validation: true, + required: false, + serialized_name: 'origin', + type: { + name: 'String' + } + }, + properties: { + client_side_validation: true, + required: false, + serialized_name: 'properties', + type: { + name: 'Object' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/operation_info.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/operation_info.rb new file mode 100644 index 0000000000..b72dd544c3 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/operation_info.rb @@ -0,0 +1,79 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Information about an operation + # + class OperationInfo + + include MsRestAzure + + # @return [String] Name of the provider + attr_accessor :provider + + # @return [String] Name of the resource type + attr_accessor :resource + + # @return [String] Name of the operation + attr_accessor :operation + + # @return [String] Description of the operation + attr_accessor :description + + + # + # Mapper for OperationInfo class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'OperationInfo', + type: { + name: 'Composite', + class_name: 'OperationInfo', + model_properties: { + provider: { + client_side_validation: true, + required: false, + serialized_name: 'provider', + type: { + name: 'String' + } + }, + resource: { + client_side_validation: true, + required: false, + serialized_name: 'resource', + type: { + name: 'String' + } + }, + operation: { + client_side_validation: true, + required: false, + serialized_name: 'operation', + type: { + name: 'String' + } + }, + description: { + client_side_validation: true, + required: false, + serialized_name: 'description', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/operations_list_result.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/operations_list_result.rb new file mode 100644 index 0000000000..6f7b266792 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/operations_list_result.rb @@ -0,0 +1,55 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Result of the List Operations operation + # + class OperationsListResult + + include MsRestAzure + + # @return [Array] A collection of operations + attr_accessor :value + + + # + # Mapper for OperationsListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'OperationsListResult', + type: { + name: 'Composite', + class_name: 'OperationsListResult', + model_properties: { + value: { + client_side_validation: true, + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'OperationElementType', + type: { + name: 'Composite', + class_name: 'Operation' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/resource.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/resource.rb new file mode 100644 index 0000000000..ee0154b42e --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/resource.rb @@ -0,0 +1,71 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Definition of a Resource + # + class Resource + + include MsRestAzure + + # @return [String] Fully qualified identifier of the resource + attr_accessor :id + + # @return [String] Name of the resource + attr_accessor :name + + # @return [String] Type of the resource + attr_accessor :type + + + # + # Mapper for Resource class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'Resource', + type: { + name: 'Composite', + class_name: 'Resource', + model_properties: { + id: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/resource_region_type.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/resource_region_type.rb new file mode 100644 index 0000000000..f878e3b440 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/resource_region_type.rb @@ -0,0 +1,16 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Defines values for ResourceRegionType + # + module ResourceRegionType + RegionalResource = "RegionalResource" + GlobalResource = "GlobalResource" + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic.rb new file mode 100644 index 0000000000..8871e18f29 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic.rb @@ -0,0 +1,112 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # EventGrid Topic + # + class Topic < TrackedResource + + include MsRestAzure + + # @return [TopicProvisioningState] Provisioning state of the topic. + # Possible values include: 'Creating', 'Updating', 'Deleting', + # 'Succeeded', 'Canceled', 'Failed' + attr_accessor :provisioning_state + + # @return [String] Endpoint for the topic. + attr_accessor :endpoint + + + # + # Mapper for Topic class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'Topic', + type: { + name: 'Composite', + class_name: 'Topic', + model_properties: { + id: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + location: { + client_side_validation: true, + required: true, + serialized_name: 'location', + type: { + name: 'String' + } + }, + tags: { + client_side_validation: true, + required: false, + serialized_name: 'tags', + type: { + name: 'Dictionary', + value: { + client_side_validation: true, + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioning_state: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'properties.provisioningState', + type: { + name: 'String' + } + }, + endpoint: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'properties.endpoint', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_provisioning_state.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_provisioning_state.rb new file mode 100644 index 0000000000..c96380beea --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_provisioning_state.rb @@ -0,0 +1,20 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Defines values for TopicProvisioningState + # + module TopicProvisioningState + Creating = "Creating" + Updating = "Updating" + Deleting = "Deleting" + Succeeded = "Succeeded" + Canceled = "Canceled" + Failed = "Failed" + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb new file mode 100644 index 0000000000..074352dc8b --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_regenerate_key_request.rb @@ -0,0 +1,46 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Topic regenerate share access key key request + # + class TopicRegenerateKeyRequest + + include MsRestAzure + + # @return [String] Key name to regenerate key1 or key2 + attr_accessor :key_name + + + # + # Mapper for TopicRegenerateKeyRequest class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'TopicRegenerateKeyRequest', + type: { + name: 'Composite', + class_name: 'TopicRegenerateKeyRequest', + model_properties: { + key_name: { + client_side_validation: true, + required: true, + serialized_name: 'keyName', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb new file mode 100644 index 0000000000..82604b1825 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_shared_access_keys.rb @@ -0,0 +1,57 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Shared access keys of the Topic + # + class TopicSharedAccessKeys + + include MsRestAzure + + # @return [String] Shared access key1 for the topic. + attr_accessor :key1 + + # @return [String] Shared access key2 for the topic. + attr_accessor :key2 + + + # + # Mapper for TopicSharedAccessKeys class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'TopicSharedAccessKeys', + type: { + name: 'Composite', + class_name: 'TopicSharedAccessKeys', + model_properties: { + key1: { + client_side_validation: true, + required: false, + serialized_name: 'key1', + type: { + name: 'String' + } + }, + key2: { + client_side_validation: true, + required: false, + serialized_name: 'key2', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_type_info.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_type_info.rb new file mode 100644 index 0000000000..5faff04a2f --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_type_info.rb @@ -0,0 +1,139 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Properties of a topic type info. + # + class TopicTypeInfo < Resource + + include MsRestAzure + + # @return [String] Namespace of the provider of the topic type. + attr_accessor :provider + + # @return [String] Display Name for the topic type. + attr_accessor :display_name + + # @return [String] Description of the topic type. + attr_accessor :description + + # @return [ResourceRegionType] Region type of the resource. Possible + # values include: 'RegionalResource', 'GlobalResource' + attr_accessor :resource_region_type + + # @return [TopicTypeProvisioningState] Provisioning state of the topic + # type. Possible values include: 'Creating', 'Updating', 'Deleting', + # 'Succeeded', 'Canceled', 'Failed' + attr_accessor :provisioning_state + + # @return [Array] List of locations supported by this topic type. + attr_accessor :supported_locations + + + # + # Mapper for TopicTypeInfo class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'TopicTypeInfo', + type: { + name: 'Composite', + class_name: 'TopicTypeInfo', + model_properties: { + id: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + provider: { + client_side_validation: true, + required: false, + serialized_name: 'properties.provider', + type: { + name: 'String' + } + }, + display_name: { + client_side_validation: true, + required: false, + serialized_name: 'properties.displayName', + type: { + name: 'String' + } + }, + description: { + client_side_validation: true, + required: false, + serialized_name: 'properties.description', + type: { + name: 'String' + } + }, + resource_region_type: { + client_side_validation: true, + required: false, + serialized_name: 'properties.resourceRegionType', + type: { + name: 'String' + } + }, + provisioning_state: { + client_side_validation: true, + required: false, + serialized_name: 'properties.provisioningState', + type: { + name: 'String' + } + }, + supported_locations: { + client_side_validation: true, + required: false, + serialized_name: 'properties.supportedLocations', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_type_provisioning_state.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_type_provisioning_state.rb new file mode 100644 index 0000000000..038e8dc30e --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_type_provisioning_state.rb @@ -0,0 +1,20 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Defines values for TopicTypeProvisioningState + # + module TopicTypeProvisioningState + Creating = "Creating" + Updating = "Updating" + Deleting = "Deleting" + Succeeded = "Succeeded" + Canceled = "Canceled" + Failed = "Failed" + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_types_list_result.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_types_list_result.rb new file mode 100644 index 0000000000..312cfdae50 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_types_list_result.rb @@ -0,0 +1,55 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Result of the List Topic Types operation + # + class TopicTypesListResult + + include MsRestAzure + + # @return [Array] A collection of topic types + attr_accessor :value + + + # + # Mapper for TopicTypesListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'TopicTypesListResult', + type: { + name: 'Composite', + class_name: 'TopicTypesListResult', + model_properties: { + value: { + client_side_validation: true, + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'TopicTypeInfoElementType', + type: { + name: 'Composite', + class_name: 'TopicTypeInfo' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb new file mode 100644 index 0000000000..207fbe90a4 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topic_update_parameters.rb @@ -0,0 +1,54 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Properties of the Topic update + # + class TopicUpdateParameters + + include MsRestAzure + + # @return [Hash{String => String}] Tags of the resource + attr_accessor :tags + + + # + # Mapper for TopicUpdateParameters class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'TopicUpdateParameters', + type: { + name: 'Composite', + class_name: 'TopicUpdateParameters', + model_properties: { + tags: { + client_side_validation: true, + required: false, + serialized_name: 'tags', + type: { + name: 'Dictionary', + value: { + client_side_validation: true, + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topics_list_result.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topics_list_result.rb new file mode 100644 index 0000000000..cfb41f9850 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/topics_list_result.rb @@ -0,0 +1,55 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Result of the List Topics operation + # + class TopicsListResult + + include MsRestAzure + + # @return [Array] A collection of Topics + attr_accessor :value + + + # + # Mapper for TopicsListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'TopicsListResult', + type: { + name: 'Composite', + class_name: 'TopicsListResult', + model_properties: { + value: { + client_side_validation: true, + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + client_side_validation: true, + required: false, + serialized_name: 'TopicElementType', + type: { + name: 'Composite', + class_name: 'Topic' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/tracked_resource.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/tracked_resource.rb new file mode 100644 index 0000000000..bc1a3e441f --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/tracked_resource.rb @@ -0,0 +1,92 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Definition of a Tracked Resource + # + class TrackedResource < Resource + + include MsRestAzure + + # @return [String] Location of the resource + attr_accessor :location + + # @return [Hash{String => String}] Tags of the resource + attr_accessor :tags + + + # + # Mapper for TrackedResource class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'TrackedResource', + type: { + name: 'Composite', + class_name: 'TrackedResource', + model_properties: { + id: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + location: { + client_side_validation: true, + required: true, + serialized_name: 'location', + type: { + name: 'String' + } + }, + tags: { + client_side_validation: true, + required: false, + serialized_name: 'tags', + type: { + name: 'Dictionary', + value: { + client_side_validation: true, + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb new file mode 100644 index 0000000000..63f81253be --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/models/web_hook_event_subscription_destination.rb @@ -0,0 +1,75 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + module Models + # + # Information about the webhook destination for an event subscription + # + class WebHookEventSubscriptionDestination < EventSubscriptionDestination + + include MsRestAzure + + + def initialize + @endpointType = "WebHook" + end + + attr_accessor :endpointType + + # @return [String] The URL that represents the endpoint of the + # destination of an event subscription. + attr_accessor :endpoint_url + + # @return [String] The base URL that represents the endpoint of the + # destination of an event subscription. + attr_accessor :endpoint_base_url + + + # + # Mapper for WebHookEventSubscriptionDestination class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + client_side_validation: true, + required: false, + serialized_name: 'WebHook', + type: { + name: 'Composite', + class_name: 'WebHookEventSubscriptionDestination', + model_properties: { + endpointType: { + client_side_validation: true, + required: true, + serialized_name: 'endpointType', + type: { + name: 'String' + } + }, + endpoint_url: { + client_side_validation: true, + required: false, + serialized_name: 'properties.endpointUrl', + type: { + name: 'String' + } + }, + endpoint_base_url: { + client_side_validation: true, + required: false, + read_only: true, + serialized_name: 'properties.endpointBaseUrl', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/module_definition.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/module_definition.rb new file mode 100644 index 0000000000..0945f00b49 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/module_definition.rb @@ -0,0 +1,9 @@ +# 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 end +module Azure::EventGrid end +module Azure::EventGrid::Mgmt end +module Azure::EventGrid::Mgmt::V2018_01_01 end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/operations.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/operations.rb new file mode 100644 index 0000000000..f8a795f001 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/operations.rb @@ -0,0 +1,115 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + # + # Azure EventGrid Management Client + # + class Operations + include MsRestAzure + + # + # Creates and initializes a new instance of the Operations class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [EventGridManagementClient] reference to the EventGridManagementClient + attr_reader :client + + # + # List available operations + # + # List the available operations supported by the Microsoft.EventGrid resource + # provider + # + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [OperationsListResult] operation results. + # + def list(custom_headers = nil) + response = list_async(custom_headers).value! + response.body unless response.nil? + end + + # + # List available operations + # + # List the available operations supported by the Microsoft.EventGrid resource + # provider + # + # @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 list_with_http_info(custom_headers = nil) + list_async(custom_headers).value! + end + + # + # List available operations + # + # List the available operations supported by the Microsoft.EventGrid resource + # provider + # + # @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 list_async(custom_headers = nil) + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'providers/Microsoft.EventGrid/operations' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::OperationsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/topic_types.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/topic_types.rb new file mode 100644 index 0000000000..75e2635e8d --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/topic_types.rb @@ -0,0 +1,296 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + # + # Azure EventGrid Management Client + # + class TopicTypes + include MsRestAzure + + # + # Creates and initializes a new instance of the TopicTypes class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [EventGridManagementClient] reference to the EventGridManagementClient + attr_reader :client + + # + # List topic types + # + # List all registered topic types + # + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [TopicTypesListResult] operation results. + # + def list(custom_headers = nil) + response = list_async(custom_headers).value! + response.body unless response.nil? + end + + # + # List topic types + # + # List all registered topic types + # + # @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 list_with_http_info(custom_headers = nil) + list_async(custom_headers).value! + end + + # + # List topic types + # + # List all registered topic types + # + # @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 list_async(custom_headers = nil) + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'providers/Microsoft.EventGrid/topicTypes' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicTypesListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Get a topic type + # + # Get information about a topic type + # + # @param topic_type_name [String] Name of the topic type + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [TopicTypeInfo] operation results. + # + def get(topic_type_name, custom_headers = nil) + response = get_async(topic_type_name, custom_headers).value! + response.body unless response.nil? + end + + # + # Get a topic type + # + # Get information about a topic type + # + # @param topic_type_name [String] Name of the topic type + # @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 get_with_http_info(topic_type_name, custom_headers = nil) + get_async(topic_type_name, custom_headers).value! + end + + # + # Get a topic type + # + # Get information about a topic type + # + # @param topic_type_name [String] Name of the topic type + # @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 get_async(topic_type_name, custom_headers = nil) + fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'providers/Microsoft.EventGrid/topicTypes/{topicTypeName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'topicTypeName' => topic_type_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicTypeInfo.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List event types + # + # List event types for a topic type + # + # @param topic_type_name [String] Name of the topic type + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventTypesListResult] operation results. + # + def list_event_types(topic_type_name, custom_headers = nil) + response = list_event_types_async(topic_type_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List event types + # + # List event types for a topic type + # + # @param topic_type_name [String] Name of the topic type + # @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 list_event_types_with_http_info(topic_type_name, custom_headers = nil) + list_event_types_async(topic_type_name, custom_headers).value! + end + + # + # List event types + # + # List event types for a topic type + # + # @param topic_type_name [String] Name of the topic type + # @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 list_event_types_async(topic_type_name, custom_headers = nil) + fail ArgumentError, 'topic_type_name is nil' if topic_type_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'topicTypeName' => topic_type_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventTypesListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + end +end diff --git a/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/topics.rb b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/topics.rb new file mode 100644 index 0000000000..e85a8e5db0 --- /dev/null +++ b/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/topics.rb @@ -0,0 +1,1092 @@ +# 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::EventGrid::Mgmt::V2018_01_01 + # + # Azure EventGrid Management Client + # + class Topics + include MsRestAzure + + # + # Creates and initializes a new instance of the Topics class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [EventGridManagementClient] reference to the EventGridManagementClient + attr_reader :client + + # + # Get a topic + # + # Get properties of a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Topic] operation results. + # + def get(resource_group_name, topic_name, custom_headers = nil) + response = get_async(resource_group_name, topic_name, custom_headers).value! + response.body unless response.nil? + end + + # + # Get a topic + # + # Get properties of a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @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 get_with_http_info(resource_group_name, topic_name, custom_headers = nil) + get_async(resource_group_name, topic_name, custom_headers).value! + end + + # + # Get a topic + # + # Get properties of a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @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 get_async(resource_group_name, topic_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'topic_name is nil' if topic_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Create a topic + # + # Asynchronously creates a new topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_info [Topic] Topic information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Topic] operation results. + # + def create_or_update(resource_group_name, topic_name, topic_info, custom_headers = nil) + response = create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers).value! + response.body unless response.nil? + end + + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_info [Topic] Topic information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers = nil) + # Send request + promise = begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper() + parsed_response = @client.deserialize(result_mapper, parsed_response) + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Delete a topic + # + # Delete existing topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + def delete(resource_group_name, topic_name, custom_headers = nil) + response = delete_async(resource_group_name, topic_name, custom_headers).value! + nil + end + + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def delete_async(resource_group_name, topic_name, custom_headers = nil) + # Send request + promise = begin_delete_async(resource_group_name, topic_name, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # Update a topic + # + # Asynchronously updates a topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Topic] operation results. + # + def update(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + response = update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers).value! + response.body unless response.nil? + end + + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Concurrent::Promise] promise which provides async access to http + # response. + # + def update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + # Send request + promise = begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers) + + promise = promise.then do |response| + # Defining deserialization method. + deserialize_method = lambda do |parsed_response| + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper() + parsed_response = @client.deserialize(result_mapper, parsed_response) + end + + # Waiting for response. + @client.get_long_running_operation_result(response, deserialize_method) + end + + promise + end + + # + # List topics under an Azure subscription + # + # List all the topics under an Azure subscription + # + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [TopicsListResult] operation results. + # + def list_by_subscription(custom_headers = nil) + response = list_by_subscription_async(custom_headers).value! + response.body unless response.nil? + end + + # + # List topics under an Azure subscription + # + # List all the topics under an Azure subscription + # + # @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 list_by_subscription_with_http_info(custom_headers = nil) + list_by_subscription_async(custom_headers).value! + end + + # + # List topics under an Azure subscription + # + # List all the topics under an Azure subscription + # + # @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 list_by_subscription_async(custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List topics under a resource group + # + # List all the topics under a resource group + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [TopicsListResult] operation results. + # + def list_by_resource_group(resource_group_name, custom_headers = nil) + response = list_by_resource_group_async(resource_group_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List topics under a resource group + # + # List all the topics under a resource group + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @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 list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil) + list_by_resource_group_async(resource_group_name, custom_headers).value! + end + + # + # List topics under a resource group + # + # List all the topics under a resource group + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @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 list_by_resource_group_async(resource_group_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicsListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List keys for a topic + # + # List the two keys used to publish to a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [TopicSharedAccessKeys] operation results. + # + def list_shared_access_keys(resource_group_name, topic_name, custom_headers = nil) + response = list_shared_access_keys_async(resource_group_name, topic_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List keys for a topic + # + # List the two keys used to publish to a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @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 list_shared_access_keys_with_http_info(resource_group_name, topic_name, custom_headers = nil) + list_shared_access_keys_async(resource_group_name, topic_name, custom_headers).value! + end + + # + # List keys for a topic + # + # List the two keys used to publish to a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @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 list_shared_access_keys_async(resource_group_name, topic_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'topic_name is nil' if topic_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:post, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicSharedAccessKeys.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Regenerate key for a topic + # + # Regenerate a shared access key for a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param regenerate_key_request [TopicRegenerateKeyRequest] Request body to + # regenerate key + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [TopicSharedAccessKeys] operation results. + # + def regenerate_key(resource_group_name, topic_name, regenerate_key_request, custom_headers = nil) + response = regenerate_key_async(resource_group_name, topic_name, regenerate_key_request, custom_headers).value! + response.body unless response.nil? + end + + # + # Regenerate key for a topic + # + # Regenerate a shared access key for a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param regenerate_key_request [TopicRegenerateKeyRequest] Request body to + # regenerate key + # @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 regenerate_key_with_http_info(resource_group_name, topic_name, regenerate_key_request, custom_headers = nil) + regenerate_key_async(resource_group_name, topic_name, regenerate_key_request, custom_headers).value! + end + + # + # Regenerate key for a topic + # + # Regenerate a shared access key for a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param regenerate_key_request [TopicRegenerateKeyRequest] Request body to + # regenerate key + # @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 regenerate_key_async(resource_group_name, topic_name, regenerate_key_request, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'topic_name is nil' if topic_name.nil? + fail ArgumentError, 'regenerate_key_request is nil' if regenerate_key_request.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + # Serialize Request + request_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicRegenerateKeyRequest.mapper() + request_content = @client.serialize(request_mapper, regenerate_key_request) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name}, + 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(:post, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicSharedAccessKeys.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # List topic event types + # + # List event types for a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param provider_namespace [String] Namespace of the provider of the topic + # @param resource_type_name [String] Name of the topic type + # @param resource_name [String] Name of the topic + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [EventTypesListResult] operation results. + # + def list_event_types(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil) + response = list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value! + response.body unless response.nil? + end + + # + # List topic event types + # + # List event types for a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param provider_namespace [String] Namespace of the provider of the topic + # @param resource_type_name [String] Name of the topic type + # @param resource_name [String] Name of the topic + # @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 list_event_types_with_http_info(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil) + list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers).value! + end + + # + # List topic event types + # + # List event types for a topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param provider_namespace [String] Namespace of the provider of the topic + # @param resource_type_name [String] Name of the topic type + # @param resource_name [String] Name of the topic + # @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 list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'provider_namespace is nil' if provider_namespace.nil? + fail ArgumentError, 'resource_type_name is nil' if resource_type_name.nil? + fail ArgumentError, 'resource_name is nil' if resource_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerNamespace' => provider_namespace,'resourceTypeName' => resource_type_name,'resourceName' => resource_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, 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 == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventTypesListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Create a topic + # + # Asynchronously creates a new topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_info [Topic] Topic information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Topic] operation results. + # + def begin_create_or_update(resource_group_name, topic_name, topic_info, custom_headers = nil) + response = begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers).value! + response.body unless response.nil? + end + + # + # Create a topic + # + # Asynchronously creates a new topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_info [Topic] Topic information + # @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 begin_create_or_update_with_http_info(resource_group_name, topic_name, topic_info, custom_headers = nil) + begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers).value! + end + + # + # Create a topic + # + # Asynchronously creates a new topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_info [Topic] Topic information + # @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 begin_create_or_update_async(resource_group_name, topic_name, topic_info, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'topic_name is nil' if topic_name.nil? + fail ArgumentError, 'topic_info is nil' if topic_info.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + # Serialize Request + request_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper() + request_content = @client.serialize(request_mapper, topic_info) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name}, + 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(:put, 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 == 201 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 201 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Delete a topic + # + # Delete existing topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def begin_delete(resource_group_name, topic_name, custom_headers = nil) + response = begin_delete_async(resource_group_name, topic_name, custom_headers).value! + nil + end + + # + # Delete a topic + # + # Delete existing topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @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 begin_delete_with_http_info(resource_group_name, topic_name, custom_headers = nil) + begin_delete_async(resource_group_name, topic_name, custom_headers).value! + end + + # + # Delete a topic + # + # Delete existing topic + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @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 begin_delete_async(resource_group_name, topic_name, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'topic_name is nil' if topic_name.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name}, + query_params: {'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:delete, 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 == 202 || status_code == 204 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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 + + # + # Update a topic + # + # Asynchronously updates a topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Topic] operation results. + # + def begin_update(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + response = begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers).value! + response.body unless response.nil? + end + + # + # Update a topic + # + # Asynchronously updates a topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @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 begin_update_with_http_info(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers).value! + end + + # + # Update a topic + # + # Asynchronously updates a topic with the specified parameters. + # + # @param resource_group_name [String] The name of the resource group within the + # user's subscription. + # @param topic_name [String] Name of the topic + # @param topic_update_parameters [TopicUpdateParameters] Topic update + # information + # @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 begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers = nil) + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'topic_name is nil' if topic_name.nil? + fail ArgumentError, 'topic_update_parameters is nil' if topic_update_parameters.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + + # Serialize Request + request_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicUpdateParameters.mapper() + request_content = @client.serialize(request_mapper, topic_update_parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'topicName' => topic_name}, + 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 == 201 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.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? + # Deserialize Response + if status_code == 201 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + end +end diff --git a/management/azure_mgmt_event_grid/lib/azure_mgmt_event_grid.rb b/management/azure_mgmt_event_grid/lib/azure_mgmt_event_grid.rb index b560c94f30..54bbc01f82 100644 --- a/management/azure_mgmt_event_grid/lib/azure_mgmt_event_grid.rb +++ b/management/azure_mgmt_event_grid/lib/azure_mgmt_event_grid.rb @@ -4,4 +4,5 @@ require '2017-06-15-preview/generated/azure_mgmt_event_grid' require '2017-09-15-preview/generated/azure_mgmt_event_grid' +require '2018-01-01/generated/azure_mgmt_event_grid' require 'profiles/latest/eventgrid_latest_profile_client' diff --git a/management/azure_mgmt_event_grid/lib/profiles/latest/modules/eventgrid_profile_module.rb b/management/azure_mgmt_event_grid/lib/profiles/latest/modules/eventgrid_profile_module.rb index c09bf6a717..b92ef97281 100644 --- a/management/azure_mgmt_event_grid/lib/profiles/latest/modules/eventgrid_profile_module.rb +++ b/management/azure_mgmt_event_grid/lib/profiles/latest/modules/eventgrid_profile_module.rb @@ -6,38 +6,38 @@ module Azure::EventGrid::Profiles::Latest module Mgmt - EventSubscriptions = Azure::EventGrid::Mgmt::V2017_09_15_preview::EventSubscriptions - Operations = Azure::EventGrid::Mgmt::V2017_09_15_preview::Operations - Topics = Azure::EventGrid::Mgmt::V2017_09_15_preview::Topics - TopicTypes = Azure::EventGrid::Mgmt::V2017_09_15_preview::TopicTypes + EventSubscriptions = Azure::EventGrid::Mgmt::V2018_01_01::EventSubscriptions + Operations = Azure::EventGrid::Mgmt::V2018_01_01::Operations + Topics = Azure::EventGrid::Mgmt::V2018_01_01::Topics + TopicTypes = Azure::EventGrid::Mgmt::V2018_01_01::TopicTypes module Models - Operation = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Operation - OperationsListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationsListResult - EventSubscriptionFilter = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionFilter - EventSubscriptionDestination = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionDestination - OperationInfo = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationInfo - EventTypesListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventTypesListResult - TopicSharedAccessKeys = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicSharedAccessKeys - EventSubscriptionUpdateParameters = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionUpdateParameters - Resource = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Resource - EventSubscriptionsListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionsListResult - EventSubscriptionFullUrl = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionFullUrl - TopicTypesListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypesListResult - TopicRegenerateKeyRequest = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicRegenerateKeyRequest - TopicsListResult = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicsListResult - WebHookEventSubscriptionDestination = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::WebHookEventSubscriptionDestination - EventHubEventSubscriptionDestination = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventHubEventSubscriptionDestination - EventSubscription = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscription - TrackedResource = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TrackedResource - Topic = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Topic - EventType = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventType - TopicTypeInfo = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypeInfo - EventSubscriptionProvisioningState = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionProvisioningState - OperationOrigin = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationOrigin - TopicProvisioningState = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicProvisioningState - ResourceRegionType = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::ResourceRegionType - TopicTypeProvisioningState = Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypeProvisioningState + OperationsListResult = Azure::EventGrid::Mgmt::V2018_01_01::Models::OperationsListResult + EventSubscriptionDestination = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionDestination + Operation = Azure::EventGrid::Mgmt::V2018_01_01::Models::Operation + Resource = Azure::EventGrid::Mgmt::V2018_01_01::Models::Resource + EventSubscriptionFilter = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionFilter + TopicSharedAccessKeys = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicSharedAccessKeys + EventTypesListResult = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventTypesListResult + TopicRegenerateKeyRequest = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicRegenerateKeyRequest + EventSubscriptionFullUrl = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionFullUrl + OperationInfo = Azure::EventGrid::Mgmt::V2018_01_01::Models::OperationInfo + TopicTypesListResult = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicTypesListResult + EventSubscriptionsListResult = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult + TopicUpdateParameters = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicUpdateParameters + EventSubscriptionUpdateParameters = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionUpdateParameters + TopicsListResult = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicsListResult + WebHookEventSubscriptionDestination = Azure::EventGrid::Mgmt::V2018_01_01::Models::WebHookEventSubscriptionDestination + EventHubEventSubscriptionDestination = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventHubEventSubscriptionDestination + EventSubscription = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscription + TrackedResource = Azure::EventGrid::Mgmt::V2018_01_01::Models::TrackedResource + Topic = Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic + EventType = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventType + TopicTypeInfo = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicTypeInfo + EventSubscriptionProvisioningState = Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionProvisioningState + TopicProvisioningState = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicProvisioningState + ResourceRegionType = Azure::EventGrid::Mgmt::V2018_01_01::Models::ResourceRegionType + TopicTypeProvisioningState = Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicTypeProvisioningState end # @@ -59,7 +59,7 @@ def initialize(options = {}) @base_url = options[:base_url].nil? ? nil:options[:base_url] @options = options[:options].nil? ? nil:options[:options] - client_0 = Azure::EventGrid::Mgmt::V2017_09_15_preview::EventGridManagementClient.new(configurable.credentials, base_url, options) + client_0 = Azure::EventGrid::Mgmt::V2018_01_01::EventGridManagementClient.new(configurable.credentials, base_url, options) if(client_0.respond_to?(:subscription_id)) client_0.subscription_id = configurable.subscription_id end @@ -80,83 +80,83 @@ def add_telemetry(client) end class ModelClasses - def operation - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Operation - end def operations_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationsListResult - end - def event_subscription_filter - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionFilter + Azure::EventGrid::Mgmt::V2018_01_01::Models::OperationsListResult end def event_subscription_destination - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionDestination + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionDestination end - def operation_info - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationInfo + def operation + Azure::EventGrid::Mgmt::V2018_01_01::Models::Operation end - def event_types_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventTypesListResult + def resource + Azure::EventGrid::Mgmt::V2018_01_01::Models::Resource end - def topic_shared_access_keys - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicSharedAccessKeys + def event_subscription_filter + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionFilter end - def event_subscription_update_parameters - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionUpdateParameters + def topic_shared_access_keys + Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicSharedAccessKeys end - def resource - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Resource + def event_types_list_result + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventTypesListResult end - def event_subscriptions_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionsListResult + def topic_regenerate_key_request + Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicRegenerateKeyRequest end def event_subscription_full_url - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionFullUrl + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionFullUrl + end + def operation_info + Azure::EventGrid::Mgmt::V2018_01_01::Models::OperationInfo end def topic_types_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypesListResult + Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicTypesListResult end - def topic_regenerate_key_request - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicRegenerateKeyRequest + def event_subscriptions_list_result + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionsListResult + end + def topic_update_parameters + Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicUpdateParameters + end + def event_subscription_update_parameters + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionUpdateParameters end def topics_list_result - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicsListResult + Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicsListResult end def web_hook_event_subscription_destination - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::WebHookEventSubscriptionDestination + Azure::EventGrid::Mgmt::V2018_01_01::Models::WebHookEventSubscriptionDestination end def event_hub_event_subscription_destination - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventHubEventSubscriptionDestination + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventHubEventSubscriptionDestination end def event_subscription - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscription + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscription end def tracked_resource - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TrackedResource + Azure::EventGrid::Mgmt::V2018_01_01::Models::TrackedResource end def topic - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::Topic + Azure::EventGrid::Mgmt::V2018_01_01::Models::Topic end def event_type - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventType + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventType end def topic_type_info - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypeInfo + Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicTypeInfo end def event_subscription_provisioning_state - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::EventSubscriptionProvisioningState - end - def operation_origin - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::OperationOrigin + Azure::EventGrid::Mgmt::V2018_01_01::Models::EventSubscriptionProvisioningState end def topic_provisioning_state - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicProvisioningState + Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicProvisioningState end def resource_region_type - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::ResourceRegionType + Azure::EventGrid::Mgmt::V2018_01_01::Models::ResourceRegionType end def topic_type_provisioning_state - Azure::EventGrid::Mgmt::V2017_09_15_preview::Models::TopicTypeProvisioningState + Azure::EventGrid::Mgmt::V2018_01_01::Models::TopicTypeProvisioningState end end end diff --git a/management/azure_mgmt_event_grid/lib/version.rb b/management/azure_mgmt_event_grid/lib/version.rb index e8820d7397..fb70b78a80 100644 --- a/management/azure_mgmt_event_grid/lib/version.rb +++ b/management/azure_mgmt_event_grid/lib/version.rb @@ -3,5 +3,5 @@ # Licensed under the MIT License. See License.txt in the project root for license information. module Azure::EventGrid::Mgmt - VERSION = '0.15.2' + VERSION = '0.15.3' end diff --git a/profile_specs/profiles.json b/profile_specs/profiles.json index a9d8847607..f6be6452ef 100644 --- a/profile_specs/profiles.json +++ b/profile_specs/profiles.json @@ -149,7 +149,7 @@ }, "Microsoft.EventGrid": { "management": { - "2017-09-15-preview": ["*"] + "2018-01-01": ["*"] } }, "Microsoft.EventHub": { @@ -416,6 +416,11 @@ "data": { "1.0": ["*"] } + }, + "Microsoft.EventGrid": { + "data": { + "2018-01-01": ["*"] + } } }, "output_dir": "azure_sdk/lib" @@ -695,7 +700,7 @@ "resourceTypes": { "Microsoft.EventGrid" : { "management": { - "2017-09-15-preview": ["*"] + "2018-01-01": ["*"] } } }, @@ -1515,6 +1520,20 @@ "output_dir": "data/azure_cognitiveservices_websearch/lib/profiles", "individual_gem_profile": true } + ], + "azure_event_grid": [ + { + "name": "Latest", + "resourceTypes": { + "Microsoft.EventGrid": { + "data": { + "2018-01-01": ["*"] + } + } + }, + "output_dir": "data/azure_event_grid/lib/profiles", + "individual_gem_profile": true + } ] } } \ No newline at end of file diff --git a/runtime/ms_rest/lib/ms_rest.rb b/runtime/ms_rest/lib/ms_rest.rb index 8d4fff9827..5f2ce516e7 100644 --- a/runtime/ms_rest/lib/ms_rest.rb +++ b/runtime/ms_rest/lib/ms_rest.rb @@ -13,7 +13,6 @@ require 'ms_rest/credentials/service_client_credentials' require 'ms_rest/credentials/basic_authentication_credentials' require 'ms_rest/credentials/token_credentials' -require 'ms_rest/credentials/cognitive_services_credentials' require 'ms_rest/rest_error.rb' require 'ms_rest/deserialization_error.rb' diff --git a/runtime/ms_rest_azure/CHANGELOG.md b/runtime/ms_rest_azure/CHANGELOG.md index 929cdeb524..6a821ae7f9 100644 --- a/runtime/ms_rest_azure/CHANGELOG.md +++ b/runtime/ms_rest_azure/CHANGELOG.md @@ -1,3 +1,7 @@ +##2018.01.30 ms_rest_azure version 0.10.2 +* Added CognitiveServicesCredentials class for the cognitive services data plane SDK. Refer [PR #1257](https://github.com/Azure/azure-sdk-for-ruby/pull/1257) for further details. +* Added TopicCredentials class for the event grid data plane SDK. Refer [PR #1257](https://github.com/Azure/azure-sdk-for-ruby/pull/1257) for further details. + ##2017.12.19 ms_rest_azure version 0.10.1 * Added support for user assigned identity to MSITokenProvider Modified portal URLs for Azure cloud environments. Refer [Issue #1175](https://github.com/Azure/azure-sdk-for-ruby/issues/1175) for further details. diff --git a/runtime/ms_rest_azure/lib/ms_rest_azure.rb b/runtime/ms_rest_azure/lib/ms_rest_azure.rb index ce6123841e..15cf637a93 100644 --- a/runtime/ms_rest_azure/lib/ms_rest_azure.rb +++ b/runtime/ms_rest_azure/lib/ms_rest_azure.rb @@ -11,6 +11,8 @@ require 'ms_rest_azure/azure_service_client.rb' require 'ms_rest_azure/cloud_error_data.rb' require 'ms_rest_azure/credentials/application_token_provider.rb' +require 'ms_rest_azure/credentials/cognitive_services_credentials.rb' +require 'ms_rest_azure/credentials/topic_credentials.rb' require 'ms_rest_azure/credentials/msi_token_provider.rb' require 'ms_rest_azure/polling_state.rb' require 'ms_rest_azure/serialization.rb' diff --git a/runtime/ms_rest/lib/ms_rest/credentials/cognitive_services_credentials.rb b/runtime/ms_rest_azure/lib/ms_rest_azure/credentials/cognitive_services_credentials.rb similarity index 76% rename from runtime/ms_rest/lib/ms_rest/credentials/cognitive_services_credentials.rb rename to runtime/ms_rest_azure/lib/ms_rest_azure/credentials/cognitive_services_credentials.rb index b89d7c88b3..2aca764b46 100644 --- a/runtime/ms_rest/lib/ms_rest/credentials/cognitive_services_credentials.rb +++ b/runtime/ms_rest_azure/lib/ms_rest_azure/credentials/cognitive_services_credentials.rb @@ -2,11 +2,11 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -module MsRest +module MsRestAzure # # Class that provides access to authentication token. # - class CognitiveServicesCredentials < ServiceClientCredentials + class CognitiveServicesCredentials < MsRest::ServiceClientCredentials private @@ -16,10 +16,11 @@ class CognitiveServicesCredentials < ServiceClientCredentials public # - # Creates and initialize new instance of the ApplicationTokenProvider class. + # Creates and initialize new instance of the CognitiveServicesCredentials class. # @param subscription_key [String] subscription key - def initialize(subscription_key) + def initialize(subscription_key) fail ArgumentError, 'Subscription key cannot be nil' if subscription_key.nil? + fail ArgumentError, 'Subscription key must be of type string' if subscription_key.class.to_s != 'String' @subscription_key = subscription_key end diff --git a/runtime/ms_rest_azure/lib/ms_rest_azure/credentials/topic_credentials.rb b/runtime/ms_rest_azure/lib/ms_rest_azure/credentials/topic_credentials.rb new file mode 100644 index 0000000000..4d8d071e92 --- /dev/null +++ b/runtime/ms_rest_azure/lib/ms_rest_azure/credentials/topic_credentials.rb @@ -0,0 +1,40 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +module MsRestAzure + # + # Class that provides access to authentication token. + # + class TopicCredentials < MsRest::ServiceClientCredentials + + private + + # @return [String] the topic key + attr_reader :topic_key + + public + + # + # Creates and initialize new instance of the TopicCredentials class. + # @param topic_key [String] topic key + def initialize(topic_key) + fail ArgumentError, 'Topic key cannot be nil' if topic_key.nil? + fail ArgumentError, 'Topic key must be of type string' if topic_key.class.to_s != 'String' + @topic_key = topic_key + end + + def sign_request(request) + super(request) + + if (request.respond_to?(:request_headers)) + request.request_headers['aeg-sas-key'] = @topic_key + elsif request.respond_to?(:headers) + request.headers['aeg-sas-key'] = @topic_key + else + fail ArgumentError, 'Incorrect request object was provided' + end + end + end + +end diff --git a/runtime/ms_rest_azure/lib/ms_rest_azure/version.rb b/runtime/ms_rest_azure/lib/ms_rest_azure/version.rb index 0ba504649a..2a37b36764 100644 --- a/runtime/ms_rest_azure/lib/ms_rest_azure/version.rb +++ b/runtime/ms_rest_azure/lib/ms_rest_azure/version.rb @@ -3,5 +3,5 @@ # Licensed under the MIT License. See License.txt in the project root for license information. module MsRestAzure - VERSION = '0.10.1' + VERSION = '0.10.2' end diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index 548e07af9d..d7f80a5b98 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -418,11 +418,23 @@ "generated_relative_base_directory": "2016-04-01", "build_dir": "management/azure_mgmt_dns/lib/2016-04-01" }, + "azure_mgmt_event_grid_2018_01_01": { + "markdown": "specification/eventgrid/resource-manager/readme.md", + "autorest_options": { + "namespace": "Azure::EventGrid::Mgmt::V2018_01_01", + "package-version": "0.15.3", + "package-name": "azure_mgmt_event_grid", + "tag": "package-2018-01" + }, + "output_dir": "management/azure_mgmt_event_grid/lib/2018-01-01", + "generated_relative_base_directory": "2018-01-01", + "build_dir": "management/azure_mgmt_event_grid/lib/2018-01-01" + }, "azure_mgmt_event_grid_2017_09_15_preview": { "markdown": "specification/eventgrid/resource-manager/readme.md", "autorest_options": { "namespace": "Azure::EventGrid::Mgmt::V2017_09_15_preview", - "package-version": "0.15.2", + "package-version": "0.15.3", "package-name": "azure_mgmt_event_grid", "tag": "package-2017-09-preview" }, @@ -434,7 +446,7 @@ "markdown": "specification/eventgrid/resource-manager/readme.md", "autorest_options": { "namespace": "Azure::EventGrid::Mgmt::V2017_06_15_preview", - "package-version": "0.15.2", + "package-version": "0.15.3", "package-name": "azure_mgmt_event_grid", "tag": "package-2017-06-preview" },