/// <summary> /// Create a new ManagedZone. /// Documentation https://developers.google.com/dns/v2beta1/reference/managedZones/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="body">A valid dns v2beta1 body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>ManagedZoneResponse</returns> public static ManagedZone Create(dnsService service, string project, ManagedZone body, ManagedZonesCreateOptionalParms 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); } // Building the initial request. var request = service.ManagedZones.Create(body, project); // Applying optional parameters to the request. request = (ManagedZonesResource.CreateRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request ManagedZones.Create failed.", ex); } }
/// <summary> /// Create a new ManagedZone. /// Documentation https://developers.google.com/dns/v1/reference/managedZones/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="body">A valid dns v1 body.</param> /// <returns>ManagedZoneResponse</returns> public static ManagedZone Create(dnsService service, string project, ManagedZone body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (project == null) { throw new ArgumentNullException(project); } // Make the request. return(service.ManagedZones.Create(body, project).Execute()); } catch (Exception ex) { throw new Exception("Request ManagedZones.Create failed.", ex); } }
protected override void ProcessRecord() { base.ProcessRecord(); ManagedZone zoneContent = new ManagedZone(); zoneContent.Name = Name; if (DnsName[DnsName.Length - 1] != '.') { zoneContent.DnsName = DnsName + '.'; } else { zoneContent.DnsName = DnsName; } zoneContent.Description = Description ?? ""; ManagedZonesResource.CreateRequest zoneCreateRequest = Service.ManagedZones.Create(zoneContent, Project); ManagedZone newZone = zoneCreateRequest.Execute(); WriteObject(newZone); }
protected override void ProcessRecord() { base.ProcessRecord(); if (!String.IsNullOrEmpty(Zone)) { ManagedZonesResource.GetRequest zoneGetRequest = Service.ManagedZones.Get(Project, Zone); ManagedZone zoneResponse = zoneGetRequest.Execute(); WriteObject(zoneResponse); } else { ManagedZonesResource.ListRequest zoneListRequest = Service.ManagedZones.List(Project); ManagedZonesListResponse zoneListResponse = zoneListRequest.Execute(); IList <ManagedZone> zoneList = zoneListResponse.ManagedZones; WriteObject(zoneList, true); } }
public async Task <ResourceRecordSet> CreateTxtRecord(string projectId, ManagedZone zone, string name, string value) { if (!name.EndsWith(".")) { name += "."; } var body = new ResourceRecordSet(); body.Kind = "dns#resourceRecordSet"; body.Name = name; body.Type = "TXT"; body.Ttl = 0; body.Rrdatas = new List <string>() { "\"" + value + "\"" }; var request = _client.Projects.ManagedZones.Rrsets.Create(body, projectId, zone.Name); return(await request.ExecuteAsync()); }
public async Task <ResourceRecordSetsDeleteResponse> DeleteTxtRecord(string projectId, ManagedZone zone, string name) { if (!name.EndsWith(".")) { name += "."; } var request = _client.Projects.ManagedZones.Rrsets.Delete(projectId, zone.Name, name, "TXT"); return(await request.ExecuteAsync()); }