コード例 #1
0
        /// <summary>
        /// Atomically update the ResourceRecordSet collection.
        /// Documentation https://developers.google.com/dns/v2beta1/reference/changes/create
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Dns service.</param>
        /// <param name="project">Identifies the project addressed by this request.</param>
        /// <param name="managedZone">Identifies the managed zone addressed by this request. Can be the managed zone name or id.</param>
        /// <param name="body">A valid Dns v2beta1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>ChangeResponse</returns>
        public static Change Create(DnsService service, string project, string managedZone, Change body, ChangesCreateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (managedZone == null)
                {
                    throw new ArgumentNullException(managedZone);
                }

                // Building the initial request.
                var request = service.Changes.Create(body, project, managedZone);

                // Applying optional parameters to the request.
                request = (ChangesResource.CreateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Changes.Create failed.", ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// Fetch the representation of an existing DnsKey.
        /// Documentation https://developers.google.com/dns/v2beta1/reference/dnsKeys/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Dns service.</param>
        /// <param name="project">Identifies the project addressed by this request.</param>
        /// <param name="managedZone">Identifies the managed zone addressed by this request. Can be the managed zone name or id.</param>
        /// <param name="dnsKeyId">The identifier of the requested DnsKey.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>DnsKeyResponse</returns>
        public static DnsKey Get(DnsService service, string project, string managedZone, string dnsKeyId, DnsKeysGetOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (managedZone == null)
                {
                    throw new ArgumentNullException(managedZone);
                }
                if (dnsKeyId == null)
                {
                    throw new ArgumentNullException(dnsKeyId);
                }

                // Building the initial request.
                var request = service.DnsKeys.Get(project, managedZone, dnsKeyId);

                // Applying optional parameters to the request.
                request = (DnsKeysResource.GetRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request DnsKeys.Get failed.", ex);
            }
        }